npm bump #43
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: "lts/*" | |
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@v4 | |
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@v4 | |
with: | |
name: pacakge-lock-version-and-release.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@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- run: npm i | |
- name: Build unsigned | |
run: npm run pkg | |
if: matrix.os != 'macos-latest' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use. | |
- name: Prep signing files | |
if: matrix.os == 'macos-latest' | |
run: | | |
echo "$APPLE_API_KEY_B64" | base64 -d > /tmp/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8 | |
env: | |
APPLE_API_KEY_B64: ${{ secrets.APPLE_API_KEY_B64 }} | |
- name: Build signed | |
run: npm run pkg | |
if: matrix.os == 'macos-latest' | |
env: | |
CSC_LINK: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }} | |
CSC_KEY_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use. | |
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
APPLE_API_KEY: "/tmp/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8" | |
- name: Archive lockfile | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pacakge-lock-${{ matrix.os }}.json | |
path: package-lock.json | |