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:
1111 steps :
1212 - name : Checkout branch
1313 uses : actions/checkout@v4
14+
1415 - name : Set up Node
1516 uses : actions/setup-node@v3
1617 with :
1718 node-version : 18
1819 registry-url : " https://registry.npmjs.org/"
1920 always-auth : " true"
21+ env :
22+ NODE_AUTH_TOKEN : ${{ secrets.PUBLISH_REACT_TO_NPM_FROM_GITHUB }}
23+
2024 - name : Install dependencies
2125 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+
2241 - name : Test, build, then publish
2342 env :
2443 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