diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 601bfde..4def708 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: permissions: - contents: read + contents: write # needed to create GitHub Releases on tag push jobs: publish: @@ -57,4 +57,19 @@ jobs: if: steps.check.outputs.skip != 'true' env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish --access public \ No newline at end of file + run: npm publish --access public + + # Keep GitHub Releases in sync with npm: create a release for the tag + # (auto-generated notes). Idempotent — skips if the release already exists. + # Uses the auto-provided github.token (no third-party action). + - name: Create GitHub Release + if: success() + env: + GH_TOKEN: ${{ github.token }} + run: | + tag="${GITHUB_REF_NAME}" + if gh release view "$tag" >/dev/null 2>&1; then + echo "::notice::Release $tag already exists — skipping" + else + gh release create "$tag" --generate-notes --title "$tag" + fi \ No newline at end of file