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
name: Build & publish binary node | |
on: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
host: | |
- x64 | |
target: | |
- x64 | |
node: | |
- 18 | |
- 14 | |
- 16 | |
include: | |
- os: windows-latest | |
node: 18 | |
host: x86 | |
target: x86 | |
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }}) | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
with: | |
msbuild-architecture: ${{ matrix.target }} | |
- name: Setup node (node=${{ matrix.node }}, host=${{ matrix.host }}) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
architecture: ${{ matrix.host }} | |
- name: Install dependencies | |
run: npm install --ignore-scripts | |
- name: Add env vars | |
shell: bash | |
run: | | |
echo "V=1" >> $GITHUB_ENV | |
if [ "${{ matrix.target }}" = "x86" ]; then | |
echo "TARGET=ia32" >> $GITHUB_ENV | |
else | |
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV | |
fi | |
- name: Configure build | |
run: ./node_modules/.bin/node-pre-gyp configure --target_arch=${{ env.TARGET }} | |
- name: Build binaries | |
run: ./node_modules/.bin/node-pre-gyp build --target_arch=${{ env.TARGET }} | |
- name: Package prebuilt binaries | |
run: ./node_modules/.bin/node-pre-gyp package --target_arch=${{ env.TARGET }} | |
# Run only for matrix.node 18 | |
- name: Upload binaries to commit artifacts | |
uses: actions/upload-artifact@v3 | |
if: matrix.node == 18 | |
with: | |
name: prebuilt-binaries | |
path: build/stage/*/* | |
retention-days: 7 | |
# Run only for matrix.node 18 | |
- name: Upload binaries to GitHub Release | |
run: ./node_modules/.bin/node-pre-gyp-github publish | |
if: matrix.node == 18 && startsWith(github.ref, 'refs/tags/') | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }} |