File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed
Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI/CD Pipeline
2+
3+ on :
4+ push :
5+ branches : [master, develop]
6+ tags : ["v*.*.*", "v*.*.*-*"]
7+ pull_request :
8+ branches : [master]
9+
10+ jobs :
11+ build-and-test :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+
18+ - name : Setup Node.js
19+ uses : actions/setup-node@v4
20+ with :
21+ node-version : " 22.3.0"
22+ cache : " yarn"
23+
24+ - name : Install dependencies
25+ run : yarn install --frozen-lockfile
26+
27+ - name : Run tests
28+ run : yarn test
29+
30+ - name : Build TypeScript
31+ run : yarn build
32+
33+ publish :
34+ needs : build-and-test
35+ runs-on : ubuntu-latest
36+ if : startsWith(github.ref, 'refs/tags/v')
37+
38+ steps :
39+ - name : Checkout repository
40+ uses : actions/checkout@v4
41+
42+ - name : Setup Node.js
43+ uses : actions/setup-node@v4
44+ with :
45+ node-version : " 22.3.0"
46+ registry-url : " https://registry.npmjs.org"
47+
48+ - name : Install dependencies
49+ run : yarn install --frozen-lockfile
50+
51+ - name : Build TypeScript
52+ run : yarn build
53+
54+ - name : Extract tag name
55+ id : tag
56+ run : echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
57+
58+ - name : Determine publish tag
59+ id : publish_tag
60+ run : |
61+ if [[ "$TAG" == *-* ]]; then
62+ echo "tag=dev" >> $GITHUB_OUTPUT
63+ else
64+ echo "tag=latest" >> $GITHUB_OUTPUT
65+ fi
66+
67+ - name : Publish to npm
68+ run : yarn publish --tag ${{ steps.publish_tag.outputs.tag }}
69+ env :
70+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments