Skip to content

Commit

Permalink
updated workflow to handle beta versions
Browse files Browse the repository at this point in the history
riyons committed Oct 31, 2024
1 parent 21b6a39 commit da8100a
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@ name: Publish Package
on:
push:
branches:
- main # Triggers on pushes to the main branch
- main # Triggers on pushes to the main branch
#tags:
# - 'v*.*.*' # Triggers on tag pushes matching the pattern
# - 'v*.*.*' # Uncomment this if you want to trigger on version tags

jobs:
build-and-publish:
@@ -26,11 +26,18 @@ jobs:
- name: Run tests
run: npm test

# If you have a build step, include it; otherwise, you can remove this step
# - name: Build the package
# run: npm run build
- name: Determine publish tag
id: determine_tag
run: |
VERSION=$(node -p "require('./package.json').version")
echo "Package version is $VERSION"
if [[ "$VERSION" == *"-beta"* ]]; then
echo "publish_tag=beta" >> $GITHUB_ENV
else
echo "publish_tag=latest" >> $GITHUB_ENV
fi
- name: Publish to npm
run: npm publish
run: npm publish --tag ${{ env.publish_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-centralized-error-handler",
"version": "1.0.15-beta.1",
"version": "1.0.16-beta.1",
"main": "src/index.js",
"scripts": {
"test": "jest",

0 comments on commit da8100a

Please sign in to comment.