Skip to content

Commit da8100a

Browse files
committed
updated workflow to handle beta versions
1 parent 21b6a39 commit da8100a

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/publish.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: Publish Package
33
on:
44
push:
55
branches:
6-
- main # Triggers on pushes to the main branch
6+
- main # Triggers on pushes to the main branch
77
#tags:
8-
# - 'v*.*.*' # Triggers on tag pushes matching the pattern
8+
# - 'v*.*.*' # Uncomment this if you want to trigger on version tags
99

1010
jobs:
1111
build-and-publish:
@@ -26,11 +26,18 @@ jobs:
2626
- name: Run tests
2727
run: npm test
2828

29-
# If you have a build step, include it; otherwise, you can remove this step
30-
# - name: Build the package
31-
# run: npm run build
29+
- name: Determine publish tag
30+
id: determine_tag
31+
run: |
32+
VERSION=$(node -p "require('./package.json').version")
33+
echo "Package version is $VERSION"
34+
if [[ "$VERSION" == *"-beta"* ]]; then
35+
echo "publish_tag=beta" >> $GITHUB_ENV
36+
else
37+
echo "publish_tag=latest" >> $GITHUB_ENV
38+
fi
3239
3340
- name: Publish to npm
34-
run: npm publish
41+
run: npm publish --tag ${{ env.publish_tag }}
3542
env:
3643
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-centralized-error-handler",
3-
"version": "1.0.15-beta.1",
3+
"version": "1.0.16-beta.1",
44
"main": "src/index.js",
55
"scripts": {
66
"test": "jest",

0 commit comments

Comments
 (0)