0.10.1 #108
Workflow file for this run
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
# Creates and publishes assets for a new release. | |
# To manually trigger this workflow, create a release in the GitHub UI. | |
name: Publish | |
'on': | |
# https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release | |
release: | |
types: | |
- created | |
# workflow_dispatch is just for testing, and it won't fully work. | |
workflow_dispatch: | |
inputs: | |
name: | |
description: fake version name | |
required: true | |
env: | |
# hack to get dynlibs working with musl | |
# https:/rust-lang/rust/pull/55163#issuecomment-436631090 | |
RUSTFLAGS: -C target-feature=-crt-static | |
jobs: | |
publish-github: | |
runs-on: ${{ matrix.system.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version: | |
- 16 | |
- 18 | |
- 20 | |
- 21 | |
system: | |
- os: macos-12 | |
target: x86_64-apple-darwin | |
arch: x64 | |
- os: buildjet-2vcpu-ubuntu-2204 | |
target: x86_64-unknown-linux-gnu | |
arch: x64 | |
- os: buildjet-4vcpu-ubuntu-2204-arm | |
target: aarch64-unknown-linux-gnu | |
arch: arm64 | |
- os: windows-2019 | |
target: x86_64-pc-windows-msvc | |
arch: x64 | |
- os: [self-hosted, macOS, ARM64] | |
target: aarch64-apple-darwin | |
arch: arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} | |
- uses: c-hive/gha-yarn-cache@v1 | |
- uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node_version }} | |
architecture: ${{ matrix.system.arch }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: ${{ matrix.system.target }} | |
override: true | |
- name: Install modules | |
run: yarn install --ignore-scripts | |
- name: Build | |
id: build | |
# Use bash, even on Windows. | |
shell: bash | |
env: | |
PRE_GYP_PLATFORM: ${{ matrix.system.pre_gyp_platform }} | |
PRE_GYP_ARCH: ${{ matrix.system.pre_gyp_arch }} | |
CARGO_BUILD_TARGET: ${{ matrix.system.target }} | |
run: | | |
node publish.js | |
cd bin-package | |
echo "asset=$(echo *.tar.gz)" >> "$GITHUB_OUTPUT" | |
- name: Upload release asset | |
run: gh release upload ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} bin-package/${{ steps.build.outputs.asset }} --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-github-docker: | |
runs-on: ${{ matrix.os }} | |
container: | |
image: node:${{ matrix.node_version }}-alpine | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version: | |
- 16 | |
- 18 | |
- 20 | |
- 21 | |
os: | |
- buildjet-2vcpu-ubuntu-2204 | |
- buildjet-4vcpu-ubuntu-2204-arm | |
steps: | |
- run: apk add build-base git python3 wget github-cli | |
# https:/actions/runner/issues/801#issuecomment-1374967227 | |
- run: | | |
apk add gcompat | |
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} | |
- uses: c-hive/gha-yarn-cache@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install modules | |
run: yarn install --ignore-scripts | |
- name: Build | |
id: build | |
run: | | |
node publish.js | |
cd bin-package | |
echo "asset=$(echo *.tar.gz)" >> "$GITHUB_OUTPUT" | |
- name: Upload release asset | |
run: | | |
git config --global --add safe.directory $(pwd) | |
gh release upload ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} bin-package/${{ steps.build.outputs.asset }} --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm: | |
if: '${{ github.event.release.tag_name }}' | |
needs: | |
- publish-github | |
- publish-github-docker | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- uses: actions/[email protected] | |
with: | |
node-version: 20 | |
cache: yarn | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install modules | |
run: yarn install --ignore-scripts | |
- run: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish NPM release | |
run: | | |
set -x | |
# If it's not a simple 1.2.3 version, then it's a prerelease of some kind. | |
if [[ ${{ github.event.release.tag_name }} =~ .*-.* ]] ; then | |
PRE="--prerelease" | |
fi | |
node publish.js --publish "${PRE}" | |
- name: Finalize GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.WORKFLOW_PAT }} | |
prerelease: ${{ contains(github.event.release.name, '-') }} | |
allowUpdates: true | |
tag: ${{ github.event.release.tag_name }} | |
name: ${{ github.event.release.name }} |