diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aef1d5bd..0989d807 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,11 +4,26 @@ on: push: branches: - main + # GitHub registers manual dispatch from the default branch. The CLI v1 job + # lives on maintenance/cli-v1 so npm provenance points to the released source. + workflow_dispatch: + inputs: + version: + description: Stable CLI version on maintenance/cli-v1 + required: true + type: string + dry_run: + description: Build and check without publishing + default: true + type: boolean -concurrency: ${{ github.workflow }}-${{ github.ref }} +# Share this group with maintenance/cli-v1 so neither release can change npm +# tags between the other release's version check and publish. +concurrency: npm-package-release jobs: release: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: write diff --git a/scripts/release-channel.test.mjs b/scripts/release-channel.test.mjs index d517df24..811e3b35 100644 --- a/scripts/release-channel.test.mjs +++ b/scripts/release-channel.test.mjs @@ -53,6 +53,16 @@ test("the channel command produces only the GitHub Actions output", () => { assert.equal(output, `prerelease=${releaseChannel(state) === "next"}\n`); }); +test("manual dispatch is registered without enabling the main publish job", () => { + const workflow = read(".github/workflows/publish.yml"); + assert.match(workflow, /workflow_dispatch:\s+inputs:\s+version:/); + assert.match(workflow, /concurrency: npm-package-release/); + assert.match( + workflow, + /release:\s+if: github\.event_name == 'push' && github\.ref == 'refs\/heads\/main'/, + ); +}); + test("all stable-doc publication steps require a stable release channel", () => { const workflow = read(".github/workflows/publish.yml"); assert.match( @@ -61,8 +71,8 @@ test("all stable-doc publication steps require a stable release channel", () => ); const conditions = workflow .split("\n") - .map((line) => line.trim()) - .filter((line) => line.startsWith("if: ")); + .filter((line) => line.startsWith(" if: ")) + .map((line) => line.trim()); assert.equal(conditions.length, 7); for (const condition of conditions) { assert.ok(