Skip to content

chore: prerelease 1.2.1-0 #51

chore: prerelease 1.2.1-0

chore: prerelease 1.2.1-0 #51

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run lint --if-present
- run: npm run build --if-present
- run: npm test --if-present
- name: Extract version and tag
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" == *-* ]]; then
echo "tag=prerelease" >> $GITHUB_OUTPUT
else
echo "tag=latest" >> $GITHUB_OUTPUT
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Publish to npm
run: npm publish --tag ${{ steps.version.outputs.tag }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}