Skip to content

release: v0.0.5

release: v0.0.5 #4

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish Package
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
echo "package-lock.json found, using 'npm ci'"
npm ci
else
echo "package-lock.json not found, using 'npm install'"
npm install
fi
- name: Run test
run: npm test
- name: Run build
run: npm run build
- name: Dry run publish
run: npm pack -dry-run
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1
publish:
env:
CHECK_NPM_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: .
- name: Set npm registry url
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
- name: Dry run publish
run: npm pack -dry-run
- name: Publish
if: ${{ env.CHECK_NPM_TOKEN == 'true'}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish . --provenance --access public
- name: Clean up
uses: geekyeggo/delete-artifact@v5
with:
name: dist