Skip to content

Release package

Release package #2

name: Release package
on:
workflow_dispatch:
inputs:
release-version:
description: 'New version number (e.g. 1.0.0)'
required: true
jobs:
release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Using pnpm v8.x
uses: pnpm/action-setup@v2
with:
version: 8
- name: Using Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'pnpm'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Git configuration
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Set version
run: |
npm --no-git-tag-version version ${{ env.NEW_VERSION }}
env:
NEW_VERSION: ${{ github.event.inputs.release-version }}
- name: Compile .node
run: pnpm run build-release
- name: Sign binary
env:
CODESIGN_PASSWORD: ${{ secrets.CODESIGN_PASSWORD }}
CODESIGN_BASE64: ${{ secrets.CODESIGN_BASE64 }}
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value $env:CODESIGN_BASE64
certutil -decode certificate\certificate.txt certificate\certificate.pfx
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x86/signtool.exe' sign /fd SHA256 /td SHA256 /p $env:CODESIGN_PASSWORD /f certificate\certificate.pfx /tr "http://ts.ssl.com" native/index.node
Remove-Item -Recurse -Force certificate
- name: Tag .node as prebuild
run: pnpm run tag-prebuild
- name: Upload prebuild artifacts
uses: actions/upload-artifact@v2
with:
name: prebuilds
path: prebuilds/
- name: Commit changed files and create tag
run: |
git add "package.json"
git commit -m "Version ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
env:
NEW_VERSION: ${{ github.event.inputs.release-version }}
- name: Publish
run: pnpm publish --access public --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
- name: Push changes to repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin && git push --tags