Skip to content

Commit dc4e808

Browse files
committed
Update
1 parent 565dd72 commit dc4e808

File tree

3 files changed

+84
-36
lines changed

3 files changed

+84
-36
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Publish Release and NPM
1+
2+
name: Publish Release
23

34
on:
45
workflow_dispatch:
@@ -16,16 +17,14 @@ jobs:
1617
version: ${{ github.event.inputs.version }}
1718
steps:
1819
- uses: actions/checkout@v6
19-
with:
20-
fetch-depth: 0
2120

2221
- name: Setup Node.js
2322
uses: actions/setup-node@v6
2423
with:
2524
node-version: '20'
2625

2726
- name: Install dependencies
28-
run: npm install
27+
run: npm ci
2928

3029
- name: Update Version
3130
run: |
@@ -53,35 +52,3 @@ jobs:
5352
git add package.json package-lock.json
5453
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
5554
git push origin HEAD:${{ github.ref }}
56-
57-
publish:
58-
needs: prep-and-release
59-
runs-on: ubuntu-latest
60-
permissions:
61-
contents: read
62-
packages: write
63-
strategy:
64-
matrix:
65-
include:
66-
- registry: 'https://registry.npmjs.org'
67-
token_name: 'NPM_TOKEN'
68-
- registry: 'https://npm.pkg.github.com'
69-
token_name: 'GITHUB_TOKEN'
70-
steps:
71-
- uses: actions/checkout@v6
72-
- name: Setup Node
73-
uses: actions/setup-node@v6
74-
with:
75-
node-version: '20'
76-
registry-url: ${{ matrix.registry }}
77-
78-
- name: Install dependencies
79-
run: npm install
80-
81-
- name: Update Version
82-
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
83-
84-
- name: Publish
85-
run: npm publish
86-
env:
87-
NODE_AUTH_TOKEN: ${{ secrets[matrix.token_name] }}

.github/workflows/node.js.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x, 20.x, 22.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- run: npm ci
30+
- run: npm run build --if-present
31+
- run: npm test

.github/workflows/npm-publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
- uses: actions/setup-node@v6
16+
with:
17+
node-version: 20
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-gpr:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- uses: actions/checkout@v6
29+
- uses: actions/setup-node@v6
30+
with:
31+
node-version: 20
32+
registry-url: https://npm.pkg.github.com/
33+
- run: npm ci
34+
- run: npm publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
37+
38+
publish-npm:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v6
43+
- uses: actions/setup-node@v6
44+
with:
45+
node-version: 20
46+
registry-url: https://registry.npmjs.org/
47+
- run: npm ci
48+
- run: npm publish
49+
env:
50+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)