Skip to content

Commit 3870297

Browse files
authored
build: change ci/cd github actions
1 parent 5d16cb9 commit 3870297

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

.github/workflows/node.js.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
# 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
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
33

4-
name: Node.js CI
4+
name: Publish to npm
55

66
on:
77
push:
8-
branches: [ "main" ]
9-
pull_request:
10-
branches: [ "main" ]
8+
tags:
9+
- '[0-9]+.[0-9]+.[0-9]+' # Example: 1.0.0, 2.1.3
1110

1211
jobs:
13-
build:
14-
12+
publish:
1513
runs-on: ubuntu-latest
1614

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-
2215
steps:
23-
- uses: actions/checkout@v4
24-
- name: Use Node.js ${{ matrix.node-version }}
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
2520
uses: actions/setup-node@v4
2621
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: yarn install --frozen-lockfile
30-
- run: yarn run build
31-
- run: yarn run test
22+
node-version: '18'
23+
registry-url: 'https://registry.npmjs.org/'
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v3
27+
with:
28+
version: 9 # đổi sang version pnpm bạn muốn
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Publish to npm
34+
run: pnpm publish --no-git-checks
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)