File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848 paths : .
4949 - codecov/upload
5050
51- deploy :
52- parameters :
53- v :
54- type : string
55- default : " lts"
56- docker :
57- - image : cimg/node:<< parameters.v >>
58- working_directory : ~/repo
59- steps :
60- - attach_workspace :
61- at : ~/repo
62- - run :
63- name : Authenticate with registry
64- command : echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
65- - run :
66- name : Publish package
67- command : npm publish
68-
69- deploy_beta :
70- parameters :
71- v :
72- type : string
73- default : " lts"
74- docker :
75- - image : cimg/node:<< parameters.v >>
76- working_directory : ~/repo
77- steps :
78- - attach_workspace :
79- at : ~/repo
80- - run :
81- name : Authenticate with registry
82- command : echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
83- - run :
84- name : Publish beta package
85- command : npm publish --tag beta
86-
8751 does_typescript_compile :
8852 docker :
8953 - image : cimg/node:22.12.0
@@ -128,48 +92,3 @@ workflows:
12892 name : Unit tests with Node current
12993 v : " 22.12.0"
13094
131- test_and_deploy :
132- jobs :
133- - unit_test :
134- name : Unit tests with Node LTS
135- v : " lts"
136- filters :
137- branches :
138- only : master
139- tags :
140- only : /^v.*/
141- - deploy :
142- name : Publish to NPM
143- v : " lts"
144- requires :
145- - Unit tests with Node LTS
146- filters :
147- branches :
148- ignore : /.*/
149- tags :
150- only : /^v[0-9]+\.[0-9]+\.[0-9]+$/
151- context :
152- - publish-npm
153-
154- test_and_deploy_beta :
155- jobs :
156- - unit_test :
157- name : Unit tests with Node LTS (Beta)
158- v : " lts"
159- filters :
160- branches :
161- only : beta
162- tags :
163- only : /^v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$/
164- - deploy_beta :
165- name : Publish Beta to NPM
166- v : " lts"
167- requires :
168- - Unit tests with Node LTS (Beta)
169- filters :
170- branches :
171- ignore : /.*/
172- tags :
173- only : /^v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$/
174- context :
175- - publish-npm
Original file line number Diff line number Diff line change 1+ name : Publish package to npm
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ permissions :
9+ contents : read
10+ id-token : write
11+
12+ jobs :
13+ publish :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v6
18+
19+ - uses : actions/setup-node@v6
20+ with :
21+ node-version : 22.14.0
22+ registry-url : https://registry.npmjs.org
23+ cache : npm
24+
25+ - name : Update npm for trusted publishing
26+ run : npm install --global npm@11
27+
28+ - name : Install dependencies
29+ run : npm install
30+
31+ - name : Build package
32+ run : npm run build
33+
34+ - name : Determine npm dist-tag
35+ id : npm_dist_tag
36+ shell : bash
37+ run : |
38+ VERSION="${GITHUB_REF_NAME#v}"
39+
40+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$ ]]; then
41+ echo "Unsupported release tag: ${GITHUB_REF_NAME}" >&2
42+ exit 1
43+ fi
44+
45+ if [[ "$VERSION" == *"-beta."* ]]; then
46+ echo "value=beta" >> "$GITHUB_OUTPUT"
47+ else
48+ echo "value=latest" >> "$GITHUB_OUTPUT"
49+ fi
50+
51+ - name : Publish package
52+ run : npm publish --tag "${{ steps.npm_dist_tag.outputs.value }}"
You can’t perform that action at this time.
0 commit comments