Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/MarketplaceRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,23 @@ 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 }}
CPAPI_USERNAME: ${{ secrets.CPAPI_USERNAME }}
CPAPI_PASS_PROD: ${{ secrets.CPAPI_PASS_PROD }}
TAG: ${{ steps.variables.outputs.tag }}
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> · <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|Logs>
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
- name: "Send slack msg on publish failure"
if: ${{ failure() }}
uses: ./.github/actions/slack-notification
with:
Expand Down
31 changes: 28 additions & 3 deletions scripts/release/marketplaceRelease.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { join } = require("path");
const { appendFileSync } = require("fs");

const config = {
appStoreUrl: "https://appstore.home.mendix.com/rest/packagesapi/v2",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -174,6 +181,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);
Expand Down Expand Up @@ -201,9 +224,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: {
Expand Down
Loading