Publish new version #35
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 new version | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| semver-checks: | |
| runs-on: ubuntu-latest | |
| name: cargo semver-checks | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: obi1kenobi/cargo-semver-checks-action@v2 | |
| publish-crate: | |
| runs-on: ubuntu-latest | |
| needs: semver-checks | |
| name: Build and publish to crates.io | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| needs: semver-checks | |
| permissions: | |
| contents: read | |
| id-token: write | |
| name: Build and publish to npm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: cargo install wasm-pack | |
| - run: npm run build | |
| - run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| publish-python: | |
| runs-on: ubuntu-latest | |
| needs: semver-checks | |
| strategy: | |
| matrix: | |
| target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| name: Build and publish Python wheels | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --features python | |
| sccache: 'true' | |
| manylinux: auto | |
| python-version: '3.8-3.13' | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: wheels-${{ matrix.target }} | |
| path: dist | |
| publish-python-sdist: | |
| runs-on: ubuntu-latest | |
| needs: semver-checks | |
| permissions: | |
| contents: read | |
| id-token: write | |
| name: Build Python source distribution | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Create virtual environment and install maturin | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| pip install maturin | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist --features python | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: sdist | |
| path: dist | |
| release-python: | |
| runs-on: ubuntu-latest | |
| needs: [publish-python, publish-python-sdist] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| name: Release Python package to PyPI | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v3 | |
| with: | |
| path: artifacts | |
| - name: Move files to dist | |
| run: | | |
| mkdir -p dist | |
| find artifacts -name "*.whl" -exec cp {} dist/ \; | |
| find artifacts -name "*.tar.gz" -exec cp {} dist/ \; | |
| - name: Publish to PyPI | |
| uses: PyPA/gh-action-pypi-publish@release/v1 |