-
Notifications
You must be signed in to change notification settings - Fork 61
42 lines (35 loc) · 1.03 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Publish to NPM
on:
release:
types: [published]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Node.js environment
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
# Determine release tag based on the tag name
- name: Determine release tag
id: release_tag
run: |
if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then
echo "tag=next" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
# Install dependencies (if any) and build your project (if necessary)
- name: Install dependencies and build
run: |
npm install
npm run build
# Publish to NPM with the appropriate tag
- name: Publish
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}