70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
name: Publish
|
|
|
|
on: [workflow_dispatch]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
publish_pytest:
|
|
uses: ./.github/workflows/pytest.yml
|
|
crates_io_publish:
|
|
needs: [ publish_pytest ]
|
|
name: Publish (crates.io)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Restore cache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
key: cache-ubuntu-cargo-publish
|
|
|
|
- name: Install Rust
|
|
run: |-
|
|
export PATH="$HOME/.cargo/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
|
|
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"
|
|
run: |-
|
|
export PATH="$HOME/.osxcross/bin:$PATH"
|
|
cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
|
|
cargo release \
|
|
publish \
|
|
--workspace \
|
|
--all-features \
|
|
--allow-branch "main" \
|
|
--no-confirm \
|
|
--no-verify \
|
|
--execute
|
|
|
|
- name: Store cache
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
key: cache-ubuntu-cargo-publish
|