v0.0.2 #17
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 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.settings.target }}) | |
| runs-on: ${{ matrix.settings.host }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target x86_64-unknown-linux-gnu | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target x86_64-unknown-linux-musl | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target aarch64-unknown-linux-gnu --zig | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target aarch64-unknown-linux-musl --zig | |
| - host: macos-latest | |
| target: x86_64-apple-darwin | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target x86_64-apple-darwin | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target aarch64-apple-darwin | |
| - host: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target x86_64-pc-windows-msvc | |
| - host: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| build: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| npm run build -- --target aarch64-pc-windows-msvc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.settings.target }} | |
| - name: Install zig | |
| if: contains(matrix.settings.target, 'linux') | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: 0.11.0 | |
| - name: Install cargo-zigbuild | |
| if: contains(matrix.settings.target, 'linux') | |
| run: cargo install cargo-zigbuild | |
| - name: Install musl tools | |
| if: contains(matrix.settings.target, 'musl') && contains(matrix.settings.target, 'x86_64') | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| - name: Install cross-compilation tools | |
| if: contains(matrix.settings.target, 'aarch64') && contains(matrix.settings.host, 'ubuntu') | |
| run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build | |
| shell: bash | |
| run: ${{ matrix.settings.build }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: crates/supermarkdown-napi/*.node | |
| if-no-files-found: error | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find artifacts -name "*.node" -type f | |
| - name: Install dependencies | |
| run: | | |
| cd crates/supermarkdown-napi | |
| npm install | |
| - name: Move artifacts | |
| run: | | |
| cd crates/supermarkdown-napi | |
| # Copy .node files from artifact subdirs to current dir | |
| find ../../artifacts -name "*.node" -type f -exec cp {} . \; | |
| ls -la *.node | |
| - name: Publish | |
| run: | | |
| cd crates/supermarkdown-napi | |
| npm publish --access public --provenance --ignore-scripts | |
| publish-crates: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Publish supermarkdown | |
| run: cargo publish -p supermarkdown --token ${{ secrets.CARGO_REGISTRY_TOKEN }} |