Release package #8
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: 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@v2 | |
- name: Using Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install Node.js dependencies | |
run: yarn | |
- 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: yarn 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: yarn 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: yarn 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 |