0.1.9 #13
Workflow file for this run
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: Publish to npm | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| verify: | |
| name: Verify Rust quality gate | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 | |
| with: | |
| toolchain: stable | |
| components: clippy, rustfmt | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-npm-verify-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo-npm-verify- | |
| - uses: ./.github/actions/rust-quality-gate | |
| publish: | |
| name: Build and publish WASM package | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| environment: Publishing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 | |
| with: | |
| toolchain: stable | |
| targets: wasm32-unknown-unknown | |
| - name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Build WASM package | |
| run: wasm-pack build crates/usfm3-wasm --target web | |
| - name: Set package name and version | |
| run: | | |
| TAG_VERSION="${GITHUB_REF#refs/tags/v}" | |
| cp crates/usfm3-wasm/node.js crates/usfm3-wasm/pkg/node.js | |
| cd crates/usfm3-wasm/pkg | |
| node -e " | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | |
| pkg.name = 'usfm3'; | |
| pkg.version = '${TAG_VERSION}'; | |
| pkg.files = ['usfm3_wasm_bg.wasm', 'usfm3_wasm.js', 'usfm3_wasm.d.ts', 'node.js']; | |
| pkg.keywords = ['usfm', 'usj', 'usx', 'vref', 'parser', 'bible', 'scripture']; | |
| pkg.exports = { | |
| '.': { | |
| node: { import: './node.js' }, | |
| default: './usfm3_wasm.js' | |
| } | |
| }; | |
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); | |
| " | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| working-directory: crates/usfm3-wasm/pkg |