From c6a7ce0b67f853210b987fc86e7ba51226fb8903 Mon Sep 17 00:00:00 2001 From: Juan Cruz Fortunatti Date: Tue, 20 Oct 2026 12:00:44 +0200 Subject: [PATCH] ci: create a GitHub release after each npm publish --- .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fb86e47..4e1b4b9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -53,3 +53,28 @@ jobs: run: npm publish --access public --ignore-scripts env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + release: + name: create GitHub release + needs: publish + timeout-minutes: 5 + runs-on: ubuntu-latest + permissions: + contents: write + env: + RELEASE_TAG: ${{ github.ref_name }} + GH_TOKEN: ${{ github.token }} + steps: + # Runs only after npm publish succeeds; an existing release is left as is, + # so re-running a publish never fails here. + - name: Create GitHub release + shell: bash + run: | + set -euo pipefail + + if gh release view "${RELEASE_TAG}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then + echo "Release ${RELEASE_TAG} already exists." + exit 0 + fi + + gh release create "${RELEASE_TAG}" --repo "${GITHUB_REPOSITORY}" --verify-tag --generate-notes --title "${RELEASE_TAG}"