Skip to content

Publish the plugin packages to npm like the extensions repository - #30

Draft
itvi-1234 wants to merge 1 commit into
runtimeconditions:mainfrom
itvi-1234:npm-publish-like-extensions
Draft

itvi-1234 wants to merge 1 commit into
runtimeconditions:mainfrom
itvi-1234:npm-publish-like-extensions

Conversation

@itvi-1234

Copy link
Copy Markdown
Member

Publish the plugin to npm, the same way as the extensions repo

This adds a manual workflow that publishes both packages to npm:

  • @runtimeconditions/plugin-runtime-conditions (frontend)
  • @runtimeconditions/plugin-runtime-conditions-backend (backend)

How it works

Both packages must have the same version in their package.json. For each package:

What npm has What the run does
Nothing (new package) Stages the first release with the NPM_STAGE_TOKEN secret. A maintainer approves it on npmjs.com under Staged Packages.
Only the staged placeholder Skips it, because the first release is still waiting for approval
This version already Skips it, so running again is safe
Older versions Publishes with npm trusted publishing (no token)

Every package is checked before anything is published, so a missing token stops the run before it publishes only one of the two.

Changes

  • New .github/workflows/publish-npm.yml: run it by hand from the Actions tab, with a dry run option. It runs only from main. When something is released, it also creates the v<version> GitHub release.
  • New scripts/publish-npm.mjs with tests in scripts/publish-npm.test.mjs. CI runs them.
  • Removed the old release.yml.
  • Set both package versions to 0.1.0.
  • Rewrote docs/releases.md with the one-time setup.

One-time setup (maintainer)

  1. Create a granular npm token, Read and write (stage only), scoped to @runtimeconditions. Save it as the NPM_STAGE_TOKEN repo secret.

  2. Run the workflow and approve both staged packages on npmjs.com.

  3. Add the trusted publisher for both packages (asks for 2FA):

    for p in @runtimeconditions/plugin-runtime-conditions @runtimeconditions/plugin-runtime-conditions-backend; do
    npm trust github "$p" --file publish-npm.yml --repo runtimeconditions/backstage-plugin --allow-publish --allow-stage-publish --yes
    done

After that, later releases need no token.

Stage a new package's first release with a stage-only token, publish later
releases through npm trusted publishing, and skip versions already on npm so
running again is safe. Replaces the old release workflow.
@itvi-1234
itvi-1234 marked this pull request as draft December 3, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant