Add repository metadata to WASM package #71
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ "**" ] | |
| workflow_dispatch: | |
| env: | |
| RUST_BACKTRACE: 1 | |
| RUST_LOG: info | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo build | |
| - run: cargo test -- --nocapture | |
| build-wasm: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: Swatinem/rust-cache@v2 | |
| - uses: jetli/wasm-pack-action@v0.4.0 | |
| - name: Build WASM | |
| run: cd apvd-wasm && wasm-pack build --target web | |
| - name: Add directory to package.json repository | |
| run: | | |
| cd apvd-wasm/pkg | |
| jq '.repository.directory = "apvd-wasm/pkg"' package.json > tmp.json && mv tmp.json package.json | |
| - name: Push dist branch | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: runsascoded/npm-dist@v1.1 | |
| with: | |
| prebuilt_dir: apvd-wasm/pkg |