chore: force use semver #16
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
--- | |
# | |
# Documentation: | |
# https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
# | |
####################################### | |
# Start the job on all push to master # | |
####################################### | |
name: 'Build & Deploy - Beta' | |
on: | |
push: | |
branches: | |
- master | |
permissions: read-all | |
concurrency: | |
group: ${{ github.ref_name }}-${{ github.workflow }} | |
cancel-in-progress: true | |
############### | |
# Set the Job # | |
############### | |
jobs: | |
# Deploy to NPM | |
deploy_to_npm: | |
name: Deploy to NPM (beta) | |
runs-on: ubuntu-latest | |
permissions: read-all | |
environment: | |
name: beta | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org | |
scope: rubenhalman | |
- run: npm ci | |
- run: | | |
git config --global user.name ${{ vars.USER_NAME }} | |
git config --global user.email ${{ vars.USER_EMAIL }} | |
- run: npm i -D semver node-jq | |
- run: export original_npm_package_version=$(npx node-jq ".version" package.json) | |
- run: export npm_package_version=$(npx semver $original_npm_package_version --increment patch --coerce) | |
- run: sed -i 's/$original_npm_package_version/"$npm_package_version"/g' package.json | |
- run: cat package.json | |
# - run: | | |
# git commit -am "ci: update package json to $npm_package_version [skip ci]" | |
# git push | |
- run: npm version $npm_package_version | |
shell: bash | |
- run: npm publish --tag beta | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKENX }} |