-
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (38 loc) · 1.24 KB
/
release.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
43
44
45
46
name: Publish Package
on:
push:
tags:
- v* # Triggers on version tags like "v1.0.0"
jobs:
publish-npm:
permissions:
id-token: write
contents: write # Necessary for fetching code and managing tokens
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure full history for changelogs or versioning
# Step 2: Set up Node.js
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: npm # Cache dependencies for faster builds
# Step 3: Install dependencies
- name: Install Dependencies
run: npm install
# Step 4: Generate Changelog (Optional)
- name: Generate Changelog
run: npx changelogithub --no-group
continue-on-error: true # Allow workflow to continue even if this step fails
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step 5: Authenticate with NPM and Publish
- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}