name: Publish_rs on: [ workflow_dispatch ] permissions: contents: read jobs: crates_io_publish: name: Publish (crates.io) runs-on: ubuntu-latest timeout-minutes: 25 env: CARGO_HOME: ${{ github.workspace }}/.cargo steps: - uses: actions/checkout@v6 - name: Restore cache uses: actions/cache/restore@v4 with: path: ${{ env.CARGO_HOME }} key: cache-ubuntu-cargo-publish - name: Install Rust run: |- export PATH="$CARGO_HOME/bin:$PATH" if ! command -v rustc >/dev/null 2>&1; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y else rustup update fi echo "$CARGO_HOME/bin" >> "$GITHUB_PATH" cargo install cargo-release shell: bash # allow-branch HEAD is because GitHub actions switches # to the tag while building, which is a detached head # Publishing is currently messy, because: # # * `peace_rt_model_core` exports `NativeError` or `WebError` depending on the target. # * `peace_rt_model_web` fails to build when publishing the workspace for a native target. # * `peace_rt_model_web` still needs its dependencies to be published before it can be # published. # * `peace_rt_model_hack` needs `peace_rt_model_web` to be published before it can be # published. # # We *could* pass through `--no-verify` so `cargo` doesn't build the crate before publishing, # which is reasonable, since this job only runs after the Linux, Windows, and WASM builds # have passed. - name: "cargo release publish" env: CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }} run: |- cargo release \ publish \ --workspace \ --all-features \ --allow-branch "main" \ --no-confirm \ --no-verify \ --execute - name: Store cache uses: actions/cache/save@v4 with: path: ${{ env.CARGO_HOME }} key: cache-ubuntu-cargo-publish