release #74
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 | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
arch: x64 | |
node: 18 | |
- os: windows-latest | |
arch: arm64 | |
node: 20 | |
- os: windows-latest | |
arch: ia32 | |
node: 16 | |
- os: macos-latest | |
arch: x64 | |
node: 18 | |
- os: macos-latest | |
arch: arm64 | |
node: 18 | |
- os: ubuntu-latest | |
arch: x64 | |
libc: glibc | |
image: ghcr.io/prebuild/almalinux-devtoolset11:2.3.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: x64 | |
libc: musl | |
image: ghcr.io/prebuild/alpine:2.1.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: arm64 | |
libc: glibc | |
image: ghcr.io/prebuild/linux-arm64-lts:2.1.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: arm64 | |
libc: musl | |
image: ghcr.io/prebuild/linux-arm64-musl:2.1.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: arm | |
libc: glibc | |
image: ghcr.io/prebuild/linux-armv7:2.1.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: arm | |
libc: musl | |
image: ghcr.io/prebuild/linux-armv7l-musl:2.3.1 | |
node: 18 | |
- os: ubuntu-latest | |
arch: arm64 | |
image: ghcr.io/prebuild/android-arm64:2.1.1 | |
node: 18 | |
runs-on: ${{matrix.os}} | |
container: | |
image: ${{matrix.image}} | |
options: -u root | |
steps: | |
- run: sudo dnf install git -y | |
if: ${{ matrix.arch == 'x64' && matrix.libc == 'glibc' }} | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: ${{matrix.node}} | |
- run: yarn --frozen-lockfile --ignore-scripts | |
- run: npm install node-gyp -g | |
- run: yarn prebuild --arch ${{ matrix.arch }} -t ${{ matrix.node }}.0.0 | |
env: | |
PREBUILD_LIBC: ${{ matrix.libc }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: prebuilds | |
path: prebuilds | |
build-freebsd: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build FreeBSD | |
uses: vmactions/freebsd-vm@v1 | |
with: | |
usesh: true | |
prepare: | | |
pkg install -y -f curl node libnghttp2 npm yarn | |
echo "~~~~ node -v ~~~~" | |
node -v | |
echo "~~~~ yarn --version ~~~~" | |
yarn --version | |
run: | | |
yarn --frozen-lockfile --ignore-scripts | |
npm install node-gyp -g | |
yarn prebuild --arch x64 -t 18.0.0 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: prebuilds | |
path: prebuilds | |
build-wasm: | |
runs-on: ubuntu-latest | |
container: | |
image: emscripten/emsdk | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: 18 | |
- run: yarn --frozen-lockfile | |
- run: make wasm | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wasm | |
path: build/Release/watcher.wasm | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- build-freebsd | |
- build-wasm | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: 18 | |
- run: yarn --frozen-lockfile --ignore-scripts | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Build npm packages | |
run: | | |
node scripts/build-npm.js | |
node scripts/build-wasm.js | |
- name: Publish to npm | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc | |
for pkg in npm/*; do | |
echo "Publishing $pkg..." | |
cd $pkg; | |
npm publish; | |
cd ../..; | |
done |