Unbreak CI #18
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: push | |
| jobs: | |
| py-build: | |
| if: github.ref_type == 'tag' | |
| name: build distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install pypa/build | |
| run: >- | |
| python3 -m | |
| pip install | |
| build | |
| --user | |
| - name: Build a binary wheel and a source tarball | |
| run: python3 -m build | |
| working-directory: python | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: python-package-distributions | |
| path: python/dist/ | |
| rust-build: | |
| if: github.ref_type == 'tag' | |
| name: build distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install stable rust | |
| run: rustup install stable | |
| - name: Format check | |
| run: cargo fmt --check | |
| working-directory: rust | |
| - name: Clippy | |
| run: cargo clippy -- --deny warnings | |
| working-directory: rust | |
| - name: Tests | |
| run: cargo test | |
| working-directory: rust | |
| - name: set version | |
| run: | | |
| export VERSION=${{ github.ref_name }} | |
| sed -i "s/0.0.0/$VERSION/g" Cargo.toml | |
| working-directory: rust | |
| - name: publish | |
| run: cargo publish --dry-run --allow-dirty | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| working-directory: rust | |
| publish-to-pypi: | |
| name: >- | |
| Publish Python distribution to PyPI | |
| if: github.ref_type == 'tag' | |
| needs: [py-build, rust-build] # Don't publish anything until both python & rust builds pass... | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| url: https://pypi.org/p/isis-streaming-data-types | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: python-package-distributions | |
| path: python/dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: python/ | |
| publish-to-crates-io: | |
| name: >- | |
| Publish Rust distribution to crates.io | |
| runs-on: ubuntu-latest | |
| if: github.ref_type == 'tag' | |
| needs: [py-build, rust-build] # Don't publish anything until both python & rust builds pass... | |
| steps: | |
| - name: publish | |
| run: cargo publish --allow-dirty | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| working-directory: rust | |
| github-release: | |
| name: >- | |
| Sign the Python distribution with Sigstore | |
| and upload them to GitHub Release | |
| needs: [py-build, publish-to-pypi, rust-build, publish-to-crates-io] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # IMPORTANT: mandatory for making GitHub Releases | |
| id-token: write # IMPORTANT: mandatory for sigstore | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: python-package-distributions | |
| path: python/dist/ | |
| - name: Sign the dists with Sigstore | |
| uses: sigstore/gh-action-sigstore-python@v3.2.0 | |
| with: | |
| inputs: >- | |
| ./python/dist/*.tar.gz | |
| ./python/dist/*.whl | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release create | |
| '${{ github.ref_name }}' | |
| --repo '${{ github.repository }}' | |
| --notes "" | |
| - name: Upload artifact signatures to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| # Upload to GitHub Release using the `gh` CLI. | |
| # `dist/` contains the built packages, and the | |
| # sigstore-produced signatures and certificates. | |
| run: >- | |
| gh release upload | |
| '${{ github.ref_name }}' python/dist/** | |
| --repo '${{ github.repository }}' |