From 2c009ca5333d44471c3dd1b1134b65bf67091ae1 Mon Sep 17 00:00:00 2001 From: Juan Cruz Fortunatti Date: Tue, 20 Oct 2026 12:00:39 +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 06f1c50..cc706a6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -75,3 +75,28 @@ jobs: run: npm publish --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.event_name == 'workflow_dispatch' && inputs.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}"