Skip to content

Commit 380a1d8

Browse files
[FSSDK-9494] Tag release correctly during publishing (#220)
* Add logic to handle proper taging * Remove testing bits
1 parent 369fa09 commit 380a1d8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/react_release.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff 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'] }}

0 commit comments

Comments
 (0)