From 77fd5ed206a5ce024634dee426965f4c12b85bb2 Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Wed, 2 Jul 2025 21:38:13 +0200 Subject: [PATCH] Add Release action --- .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4db6150 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + + - name: Get package.json version + id: package-json-version + run: echo "version=v$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT + + - name: Check package.json version against tag name + if: steps.package-json-version.outputs.version != github.event.release.tag_name + uses: actions/github-script@v3 + with: + script: core.setFailed('Release tag does not match package.json version!') + + - name: Install dependencies + run: npm ci + + - name: Run build + run: npm run build + + - name: Create Publish to npm + run: npm publish --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}