[publish binary] #92
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: CI | |
on: push | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
node-version: [22.x, 20.x] | |
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners | |
# macos-13 runs on intel processors, macos-14 runs on apple silicon | |
os: [ubuntu-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cached-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Test | |
run: yarn test | |
#- name: Package | |
# run: yarn package | |
#- name: Release | |
# uses: softprops/action-gh-release@v1 | |
# if: startsWith(github.ref, 'refs/tags/') | |
# with: | |
# files: build/**/*.tar.gz | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
# Publish when using '[publish binary]' keywords | |
- name: Publish | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} | |
if: "contains(github.event.head_commit.message, '[publish binary]')" | |
run: | | |
COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\n') \ | |
yarn upload-binary |