-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnpm-publish-github-packages.yml
More file actions
50 lines (41 loc) 路 1.21 KB
/
Copy pathnpm-publish-github-packages.yml
File metadata and controls
50 lines (41 loc) 路 1.21 KB
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
47
48
49
50
name: Publish Node.js Package
on:
release:
types: [created]
jobs:
# Job 1: Build and Test
build:
name: Build Application
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
# Job 2: Publish Package to GitHub Packages
publish-gpr:
needs: build # Only runs after the 'build' job is successful
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js with GitHub Packages registry
uses: actions/setup-node@v3
with:
node-version-file: package.json # Automatically fetches Node.js version from package.json
registry-url: https://npm.pkg.github.com/
- name: Install dependencies
run: npm ci
- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub token for authentication