diff --git a/.github/workflows/MarketplaceRelease.yml b/.github/workflows/MarketplaceRelease.yml index 39a14ed04..bc61ff0a7 100644 --- a/.github/workflows/MarketplaceRelease.yml +++ b/.github/workflows/MarketplaceRelease.yml @@ -44,6 +44,7 @@ jobs: GH_PAT: ${{ secrets.GH_PAT }} TAG: ${{ steps.variables.outputs.tag }} - name: "Check changes and publish package ${{ steps.variables.outputs.tag }}" + id: publish run: pnpm --filter=${{ steps.scope.outputs._0 }} run release:marketplace env: OPENID_URL: ${{ secrets.OPENID_URL }} @@ -52,7 +53,15 @@ jobs: TAG: ${{ steps.variables.outputs.tag }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MENDIX_PAT_TOKEN: ${{ secrets.MENDIX_PAT_TOKEN }} - - name: "Send slack msg on failure" + - name: "Send slack notification on verification failure" + if: ${{ steps.publish.outputs.verification_failed == 'true' }} + uses: ./.github/actions/slack-notification + with: + channel-id: ${{ secrets.SLACK_CHANNEL_ID }} + message: | + :warning: *${{ steps.scope.outputs._0 }}* v${{ steps.scope.outputs._1 }} — published successfully but verification step failed. Please check manually: <${{ steps.publish.outputs.marketplace_url }}|Marketplace> · + bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Send slack msg on publish failure" if: ${{ failure() }} uses: ./.github/actions/slack-notification with: diff --git a/scripts/release/marketplaceRelease.js b/scripts/release/marketplaceRelease.js index 7a5454745..dd0a3c936 100644 --- a/scripts/release/marketplaceRelease.js +++ b/scripts/release/marketplaceRelease.js @@ -1,4 +1,5 @@ const { join } = require("path"); +const { appendFileSync } = require("fs"); const config = { appStoreUrl: "https://appstore.home.mendix.com/rest/packagesapi/v2", @@ -44,7 +45,13 @@ async function uploadModuleToAppStore(pkgName, marketplaceId, version, minimumMX await publishDraft(postResponse.UUID); console.log(`Successfully uploaded ${pkgName} to the Mendix Marketplace.`); - await verifyReleasePublished(marketplaceId, version, pkgName); + try { + await verifyReleasePublished(marketplaceId, version, pkgName); + } catch (verificationError) { + console.warn(`⚠️ WARNING: ${verificationError.message}`); + console.warn(`Please manually verify at: https://marketplace.mendix.com/link/component/${marketplaceId}`); + setVerificationFailedOutput(marketplaceId); + } } catch (error) { error.message = `Failed uploading ${pkgName} to appstore with error: ${error.message}`; throw error; @@ -172,6 +179,22 @@ async function fetchData(method, url, body, additionalHeaders) { } } +function setVerificationFailedOutput(marketplaceId) { + try { + const githubOutput = process.env.GITHUB_OUTPUT; + if (githubOutput) { + appendFileSync( + githubOutput, + `verification_failed=true\nmarketplace_url=https://marketplace.mendix.com/link/component/${marketplaceId}\n` + ); + } + } catch (error) { + console.warn( + `Failed to set GitHub Actions output: ${error.message}. Please manually verify the release at https://marketplace.mendix.com/link/component/${marketplaceId}` + ); + } +} + function packageMetadata() { const pkgPath = join(process.cwd(), "package.json"); const { name, widgetName, version, marketplace } = require(pkgPath); @@ -199,9 +222,11 @@ async function verifyReleasePublished(contentId, expectedVersion, pkgName) { console.log(`Verification attempt ${attempt}/${maxRetries}: Checking for version ${expectedVersion}`); try { - // Call the Mendix Content API to get all released module versions + // Call the Mendix Content API to get all released module versions since the last 24 hours + const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); + const publishedSince = yesterday.toISOString().split("T")[0]; const versionsResponse = await fetch( - `https://marketplace-api.mendix.com/v1/content/${contentId}/versions`, + `https://marketplace-api.mendix.com/v1/content/${contentId}/versions?publishedSince=${publishedSince}`, { method: "GET", headers: {