Skip to content

v0.6.0

v0.6.0 #18

Workflow file for this run

name: 'Publish to npm'
on:
release:
types: [created, published]
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1
- name: Use Node.js v20
uses: actions/setup-node@v1
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Check if package.json Version matches tag
uses: actions/github-script@v6
env:
TAG: ${{ github.ref_name }}
with:
script: |
const fs = require('fs')
const packageJson = JSON.parse(fs.readFileSync('${{ github.workspace }}/package.json'))
const pjv = packageJson.version
const tv = process.env.TAG.replace('v', '')
if (pjv !== tv) {
throw new Error(`The tagged release, ${tv}, doesn't match the package.json version, ${pjv}. Please fix the issue, delete the tag & release and try again.`)
}
- name: Install Packages
run: npm ci
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}