takt/.github/workflows/publish.yml
2026-02-05 17:46:52 +09:00

35 lines
788 B
YAML

name: Publish to npm
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npm test
- name: Determine npm tag
id: npm-tag
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
if echo "$VERSION" | grep -qE '(alpha|beta|rc|next)'; then
echo "tag=next" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
- run: npm publish --tag ${{ steps.npm-tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}