Skip to content

v1.0.0-alpha.1

v1.0.0-alpha.1 #12

Workflow file for this run

name: Publish Package
on:
release:
types: [published]
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'package/package-lock.json'
- name: Install dependencies
working-directory: ./package
run: npm ci
- name: Run tests
working-directory: ./package
run: npm test
- name: Build
working-directory: ./package
run: npm run build
- name: Publish to NPM
working-directory: ./package
run: |
VER=$(node -p "require('./package.json').version")
if echo "$VER" | grep -q '-'; then
echo "Detected prerelease version $VER -> publishing with tag 'next'"
npm publish --tag next --access public
else
echo "Publishing stable version $VER"
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.SHNIPPET_NPM_TOKEN }}