File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,34 @@ jobs:
11
11
steps :
12
12
- name : Checkout branch
13
13
uses : actions/checkout@v4
14
+
14
15
- name : Set up Node
15
16
uses : actions/setup-node@v3
16
17
with :
17
18
node-version : 18
18
19
registry-url : " https://registry.npmjs.org/"
19
20
always-auth : " true"
21
+ env :
22
+ NODE_AUTH_TOKEN : ${{ secrets.PUBLISH_REACT_TO_NPM_FROM_GITHUB }}
23
+
20
24
- name : Install dependencies
21
25
run : yarn install
26
+
27
+ - id : npm-tag
28
+ name : Determine NPM tag
29
+ run : |
30
+ version=$(jq -r '.version' package.json)
31
+ if [[ "$version" == *"-beta"* ]]; then
32
+ echo "npm-tag=beta" >> "$GITHUB_OUTPUT"
33
+ elif [[ "$version" == *"-alpha"* ]]; then
34
+ echo "npm-tag=alpha" >> "$GITHUB_OUTPUT"
35
+ elif [[ "$version" == *"-rc"* ]]; then
36
+ echo "npm-tag=rc" >> "$GITHUB_OUTPUT"
37
+ else
38
+ echo "npm-tag=latest" >> "$GITHUB_OUTPUT"
39
+ fi
40
+
22
41
- name : Test, build, then publish
23
42
env :
24
43
NODE_AUTH_TOKEN : ${{ secrets.PUBLISH_REACT_TO_NPM_FROM_GITHUB }}
25
- run : npm publish
44
+ run : npm publish --tag ${{ steps.npm-tag.outputs['npm-tag'] }}
You can’t perform that action at this time.
0 commit comments