diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 90dad13..3b0f034 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,8 +1,16 @@ name: NPM Publish Package on: + # "published" fires whether a release is created directly or finalized from a + # draft (softprops/action-gh-release creates a draft, then finalizes it). release: - types: [created] + types: [published] + # Manual fallback to publish an existing tag, e.g. if a release run was missed. + workflow_dispatch: + inputs: + tag: + description: "Tag to publish, e.g. v3.0.0" + required: true permissions: id-token: write # Required for OIDC @@ -13,6 +21,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} - uses: actions/setup-node@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d3c96f..10a5686 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,5 +138,7 @@ jobs: target_commitish: ${{ steps.bump.outputs.sha }} name: Release v${{ steps.version.outputs.version }} generate_release_notes: true - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + # Must be the `token` input: the action ignores a GITHUB_TOKEN env var + # and would create the release as github-actions[bot], whose events + # don't trigger npm-publish.yml. + token: ${{ secrets.RELEASE_TOKEN }}