Skip to content

chore: Update deps

chore: Update deps #49

name: Build & Release
env:
DEBUG: napi:*
APP_NAME: thanks-contributors
MACOSX_DEPLOYMENT_TARGET: "10.13"
RUST_BACKTRACE: full
NODE_VERSION: 20
on:
push:
branches:
- main
tags-ignore:
- "**"
paths-ignore:
- "**/*.md"
- LICENSE
- "**/*.gitignore"
- .editorconfig
- docs/**
pull_request: null
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
strip: strip -x # Must use -x on Mac OS. This produces larger results on Linux.
name: build-${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- uses: dtolnay/rust-toolchain@stable
- name: Setup rust target
run: rustup target add ${{ matrix.target }}
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Build release
run: yarn build
shell: bash
- name: Strip debug symbols
if: ${{ matrix.strip }}
run: ${{ matrix.strip }} *.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
build-apple-silicon:
name: build-apple-silicon
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- uses: dtolnay/rust-toolchain@stable
- name: Setup rust target
run: rustup target add aarch64-apple-darwin
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Build release
run: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
shell: bash
- name: Strip debug symbols
run: strip -x *.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-aarch64-apple-darwin
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
build-linux:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
strip: strip
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
- target: x86_64-unknown-linux-musl
strip: strip
setup: apk add perl
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
- target: aarch64-unknown-linux-musl
strip: aarch64-linux-musl-strip
setup: apk add perl
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
# Currently broken images
#
# - target: aarch64-unknown-linux-gnu
# strip: aarch64-linux-gnu-strip
# image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
# - target: armv7-unknown-linux-gnueabihf
# strip: arm-linux-gnueabihf-strip
# image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
# setup: sudo apt-get update && sudo apt-get install gcc-arm-linux-gnueabihf -y
name: build-${{ matrix.target }}
runs-on: ubuntu-latest
container: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- uses: dtolnay/rust-toolchain@stable
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: 0.10.0
- name: Setup cross compile toolchain
if: ${{ matrix.setup }}
run: ${{ matrix.setup }}
shell: bash
- name: Setup rust target
run: rustup target add ${{ matrix.target }}
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Build release
run: yarn build --target ${{ matrix.target }}
shell: bash
- name: Strip debug symbols
if: ${{ matrix.strip }}
run: ${{ matrix.strip }} *.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- build
- build-apple-silicon
- build-linux
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}