npm bump #20
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
name: npm bump | |
on: | |
workflow_dispatch: | |
inputs: | |
newversion: | |
description: 'npm version {major,minor,patch}' | |
required: true | |
env: | |
node_version: '19' | |
FORCE_COLOR: 1 | |
concurrency: # prevent concurrent releases | |
group: npm-bump | |
cancel-in-progress: true | |
jobs: | |
version_and_release: | |
runs-on: ubuntu-latest | |
outputs: | |
tagName: ${{ steps.npm-bump.outputs.release_tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch full history so things like auto-changelog work properly | |
fetch-depth: 0 | |
- name: Use Node.js ${{ env.node_version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node_version }} | |
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm i | |
- run: npm test | |
- name: npm version && npm publish | |
id: npm-bump | |
uses: bcomnes/npm-bump@v2 | |
with: | |
git_email: [email protected] | |
git_username: ${{ github.actor }} | |
newversion: ${{ github.event.inputs.newversion }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_cmd: npm run release | |
- name: Archive lockfile | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pacakge-lock.json | |
path: package-lock.json | |
build-release: | |
needs: version_and_release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- run: echo ${{needs.version_and_release.outputs.tagName}} | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{needs.version_and_release.outputs.tagName}} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node_version }} | |
- run: npm i | |
- run: npm run pkg | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use. | |
- name: Archive lockfile | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pacakge-lock.json | |
path: package-lock.json | |