Skip to content

[build] Build a universal binary on macOS 11 or higher #74

[build] Build a universal binary on macOS 11 or higher

[build] Build a universal binary on macOS 11 or higher #74

Workflow file for this run

name: CI
on:
- push
- pull_request
permissions: {}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch:
- x64
- x86
node:
- 18
- 20
- 22
os:
- macos-latest
- ubuntu-latest
- windows-latest
exclude:
- arch: x86
os: macos-latest
- arch: x86
os: ubuntu-latest
- arch: x86
node: 18
os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- run: npm install
- run: npm test
build:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch:
- x64
- x86
os:
- macos-latest
- ubuntu-20.04
- windows-latest
exclude:
- arch: x86
os: macos-latest
- arch: x86
os: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ matrix.arch }}
- run: npm install
- run: npm run prebuild
if: matrix.os != 'macos-latest'
- run: npm run prebuild-darwin-x64+arm64
if: matrix.os == 'macos-latest'
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}
path: prebuilds
retention-days: 1
release:
needs: build
permissions:
contents: write # Needed for softprops/action-gh-release.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: prebuilds
- run: echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
id: get_version
- run:
tar -cvf "${{ steps.get_version.outputs.version
}}-darwin-x64+arm64.tar" -C "prebuilds/macos-latest-x64"
darwin-x64+arm64
- run:
tar -cvf "${{ steps.get_version.outputs.version }}-linux-x64.tar" -C
"prebuilds/ubuntu-20.04-x64" linux-x64
- run:
tar -cvf "${{ steps.get_version.outputs.version }}-win32-ia32.tar" -C
"prebuilds/windows-latest-x86" win32-ia32
- run:
tar -cvf "${{ steps.get_version.outputs.version }}-win32-x64.tar" -C
"prebuilds/windows-latest-x64" win32-x64
- uses: softprops/action-gh-release@v2
with:
files: ${{ steps.get_version.outputs.version }}-*.tar
token: ${{ secrets.GITHUB_TOKEN }}