Bump release-it from 17.10.0 to 17.11.0 (#348) #852
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Node.js Package | |
on: | |
push: | |
branches: | |
- main | |
- release | |
tags: | |
- 'beta-v*' | |
pull_request: | |
# Trigger only for PRs that target main branch | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run check-format | |
- run: npm test --if-present | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- id: version | |
name: Generate NPM_VERSION and PUBLISH_TAG | |
run: | | |
npm install -g json | |
JACKSON_VERSION=$(echo $(cat package.json) | json version) | |
publishTag="latest" | |
if [[ "$GITHUB_REF" == *\/release ]] | |
then | |
echo "Release branch" | |
else | |
echo "Dev branch" | |
publishTag="beta" | |
JACKSON_VERSION="${JACKSON_VERSION}-beta.${GITHUB_RUN_NUMBER}" | |
fi | |
json -I -f package.json -e "this.version=\"${JACKSON_VERSION}\"" | |
echo "NPM_VERSION=${JACKSON_VERSION}" >> $GITHUB_OUTPUT | |
echo "PUBLISH_TAG=${publishTag}" >> $GITHUB_OUTPUT | |
- run: npm publish --tag ${{ steps.version.outputs.PUBLISH_TAG }} --access public | |
if: github.ref == 'refs/heads/release' || contains(github.ref, 'refs/tags/beta-v') | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |