Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
release:
types: [published]
permissions:
contents: read
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
# Get the 'version' field out of the package.json file
- name: Get package.json version
id: package-json-version
run: echo "version=v$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT
# Abort if the version in the package.json file doesn't match the tag name of the release
- 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: Build the package
run: npm run build
- name: Create Publish to npm
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}