Skip to content

[WC-3673]: feat(automation): publish to Marketplace through the Publish API - #2542

Open
r0b1n wants to merge 3 commits into
mainfrom
r0b1n/marketplace-publish-api
Open

r0b1n wants to merge 3 commits into
mainfrom
r0b1n/marketplace-publish-api

Conversation

@r0b1n

@r0b1n r0b1n commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Pull request type

New feature (non-breaking change which adds functionality)


Why

Marketplace is moving from the Contributor API's GitHub integration to the Publish API. Instead of pointing the Marketplace at a GitHub release asset, we now supply the release data and upload the MPK ourselves.

Before merging: add the MARKETPLACE_PAT repo secret (service account PAT; the account must be a developer on every component). The CPAPI_* / SRV_WIDGETS_OPENID secrets can be removed afterwards.

What changed

  • rui-publish-marketplace creates a draft (publishManually: true), uploads the MPK taken from the GitHub release (with READMEOSS already embedded), then publishes explicitly. Client: src/api/marketplace-publish.ts.
  • Release notes come from the GitHub release body, converted from markdown to simple HTML by releaseNotesToHtml (src/release-notes-html.ts). Headings start at h4 because the Marketplace page renders the release title as h3; raw HTML is escaped. The options are kept in one place so we can tune the output. Preview: pnpm --filter @mendix/automation-utils run release-notes-html <tag|file.md>.
  • Drafts never get stuck. The API can't list releases, so a draft with a lost id blocks its version until someone removes it in the Marketplace UI. The script deletes its draft when upload or publish fails or the job is cancelled (SIGINT/SIGTERM), and writes the release id to the job summary as soon as the draft exists. A 409 on create explains how to remove a leftover draft.
  • Warns (log + job summary) when the Marketplace component name differs from marketplace.appName.
  • release-widget skill: release-notes note in Phase 6, new failure handling in Phase 7, unpublish via API in Phase 8.

Scope

automation/utils, PublishMarketplace.yml, turbo.json, release-widget skill. No widget or shared package changes, so no changelog. Adds markdown-it (already used by markdown-web) to automation/utils; pnpm also dropped one stale peer-variant snapshot of pluggable-widgets-tools from the lockfile.

Tradeoffs

  • Lost fields: the Publish API has no name or React-ready field. The old call sent Name: appName, which renamed the listing; renames now have to be done in the Marketplace UI (hence the warning). React-ready lives on the component.
  • Source of release notes: the GitHub release body rather than CHANGELOG.md, so edits to the draft release are what gets published, as before.

Blast radius

None outside the release automation. fetch.ts loses its Marketplace-specific 409 hint; its remaining callers are GitHub API calls, which now get the generic error for a 409. contributor.ts had no other callers.

Verification

  • automation/utils: tsc, lint (no new warnings) and pnpm run test (30/30) pass. The cancel test runs a child process, sends SIGTERM during the upload, and checks the draft is deleted and the exit code is 143.
  • Against a throwaway sandbox component (since removed), using the same client:
    • create + upload + publish → Published immediately; two drafts of different versions can coexist; creating an existing version (even a draft) → 409.
    • corrupt MPK upload → 400 (Widget package version does not match the Release version number), draft deleted, rerun of the same version succeeded.
    • the server keeps our HTML tags as sent, adding only rel="nofollow" to links.
  • Unproven until the next real release: the full workflow run with MARKETPLACE_PAT, and whether a CI cancel signal reaches node through pnpm and turbo. The job summary's release id is the fallback if it doesn't.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@r0b1n r0b1n changed the title feat(automation): publish to Marketplace through the Publish API [WC-3673]: feat(automation): publish to Marketplace through the Publish API Nov 19, 2026
@iobuhov iobuhov self-assigned this Nov 19, 2026
@r0b1n
r0b1n force-pushed the r0b1n/marketplace-publish-api branch from 4b8b16d to 54138b3 Compare November 20, 2026 10:33
@github-actions

This comment has been minimized.

gjulivan
gjulivan previously approved these changes Nov 20, 2026
iobuhov
iobuhov previously approved these changes Nov 20, 2026
Replace the Contributor API's GitHub integration with the Marketplace
Publish API. The publish script now creates a draft release, uploads the
MPK from the GitHub release itself and publishes it explicitly.

- Release notes come from the GitHub release body, converted from
  markdown to simple HTML. Headings start at h4 because the Marketplace
  page renders the release title as h3. `release-notes-html <tag|file>`
  previews the output.
- A draft is deleted when the upload or publish fails or the job is
  cancelled. The API can't list releases, so a lost draft would block its
  version until it is removed in the Marketplace UI. The draft id is
  written to the job summary as soon as it exists.
- A 409 on create explains how to remove a leftover draft.
- Warn when the Marketplace component name differs from
  marketplace.appName, since the Publish API can't rename components.
- Auth is a single MX_PAT (secret MARKETPLACE_PAT) instead of the
  CPAPI_* credentials.
@r0b1n
r0b1n dismissed stale reviews from iobuhov and gjulivan via 0edd6b6 November 20, 2026 14:46
@r0b1n
r0b1n force-pushed the r0b1n/marketplace-publish-api branch from 54138b3 to 0edd6b6 Compare November 20, 2026 14:46
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

✅ Approved — no issues found


What was reviewed

File Change
automation/utils/src/api/marketplace-publish.ts New Publish API client. It creates a draft, uploads the MPK, publishes, and deletes the draft on failure or on SIGINT/SIGTERM.
automation/utils/bin/rui-publish-marketplace.ts Publishes through the Publish API. Release notes come from the GitHub release body, and the script writes a job summary and a name-mismatch warning.
automation/utils/src/release-notes-html.ts, bin/rui-release-notes-html.ts Markdown-to-HTML conversion for release notes, plus a preview CLI.
automation/utils/src/api/contributor.ts, fetch.ts, github.ts Removes the Contributor API client and its 409 hint. Adds GitHub release helpers.
automation/utils/src/__tests__/* Tests for the client, the cancel flow (child process), and the HTML conversion.
.github/workflows/PublishMarketplace.yml, turbo.json Switches to the MARKETPLACE_PAT secret, exposed as MX_PAT.
.agents/skills/release-widget/SKILL.md Release-notes note, new failure handling and unpublish guidance.

Skipped (out of scope): pnpm-lock.yaml

CI: pending: Run code quality check, Plan E2E matrix, sigridci, code/snyk · unrelated failure: security/snyk (external scanner; not traced to this diff)


Questions

  • The PR notes that the full workflow run with MARKETPLACE_PAT is unproven, and so is whether a cancel signal reaches node through pnpm and turbo. Is the secret in place before merge? The job-summary release id is the fallback if the signal doesn't arrive.

Positives

  • Draft cleanup is handled on upload failure, publish failure and cancellation. The draft id is recorded as soon as it exists.
  • The cancel path has a test that runs a child process, sends SIGTERM during the upload and checks the exit code and the draft deletion.
  • The PR description has clear Tradeoffs, Blast radius and Verification sections. Packages with no changelog are explained.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants