| 1 | name: Publish |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: [published] |
| 6 | workflow_call: |
| 7 | secrets: |
| 8 | NPM_TOKEN: |
| 9 | required: true |
| 10 | |
| 11 | jobs: |
| 12 | publish: |
| 13 | name: Publish to npm |
| 14 | runs-on: ubuntu-latest |
| 15 | permissions: |
| 16 | contents: read |
| 17 | id-token: write |
| 18 | steps: |
| 19 | - name: Preserve line endings |
| 20 | run: git config --global core.autocrlf false |
| 21 | - name: Checkout |
| 22 | uses: actions/checkout@v4 |
| 23 | - name: Install latest rust stable |
| 24 | uses: actions-rs/toolchain@v1 |
| 25 | with: |
| 26 | toolchain: stable |
| 27 | override: true |
| 28 | profile: minimal |
| 29 | - name: Install wasm-pack |
| 30 | uses: jetli/[email protected] |
| 31 | with: |
| 32 | version: 'latest' |
| 33 | - uses: actions/setup-node@v4 |
| 34 | with: |
| 35 | node-version: '22.x' |
| 36 | registry-url: 'https://registry.npmjs.org' |
| 37 | - name: Build wasm/js package |
| 38 | run: | |
| 39 | cargo clean |
| 40 | wasm-pack build --release --scope one-ini --target nodejs |
| 41 | - name: Publish to npm |
| 42 | run: | |
| 43 | npm pkg set name='@one-ini/wasm' |
| 44 | npm pack --dry-run |
| 45 | npm publish --access public --provenance |
| 46 | working-directory: pkg |
| 47 | env: |
| 48 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |