Skip to content

Merge pull request #245 from noahbald/chore/edition-2024 #400

Merge pull request #245 from noahbald/chore/edition-2024

Merge pull request #245 from noahbald/chore/edition-2024 #400

Workflow file for this run

name: wasm
env:
DEBUG: napi:*
APP_NAME: oxvg
MACOSX_DEPLOYMENT_TARGET: '10.13'
'on':
push:
branches:
- main
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request: null
jobs:
build:
name: wasm - node@22
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: wasm32-unknown-unknown
- name: Install dependencies
run: pnpm install
- name: Setup node x86
uses: actions/setup-node@v4
- name: Build
run: pnpm --filter @oxvg/wasm build
shell: bash
- name: Test
run: pnpm --filter @oxvg/wasm test
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: bindings-wasm
path: packages/wasm/dist/
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
needs:
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: bindings-wasm
path: packages/wasm/dist/
- name: List artifacts
run: ls -R packages/wasm
shell: bash
- name: Publish eligiblity
id: release_check
run: |
MSG="$(git log -1 --pretty=%B)"
TAG="$(git tag --points-at HEAD | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$' | head -n1 || true)"
if [[ "${{ github.ref }}" == "refs/heads/main" && "$MSG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
else
echo "should_release=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: Publish
if: steps.release_check.outputs.should_release == 'true'
working-directory: packages/wasm
run: |
npm install -g npm
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
if: steps.release_check.outputs.should_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_check.outputs.tag }}
files: packages/wasm/dist/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}