Skip to content

Commit 2389582

Browse files
committed
add publish workflow
1 parent f3af8a0 commit 2389582

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
push:
3+
tags:
4+
# runs every time a new tag is made
5+
- '*'
6+
7+
name: Publish
8+
9+
jobs:
10+
crates_io_publish:
11+
name: Publish (crates.io)
12+
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: dtolnay/rust-toolchain@nightly
18+
19+
- name: cargo-release Cache
20+
id: cargo_release_cache
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.cargo/bin/cargo-release
24+
key: ${{ runner.os }}-cargo-release
25+
26+
- run: cargo install cargo-release
27+
if: steps.cargo_release_cache.outputs.cache-hit != 'true'
28+
29+
- name: cargo login
30+
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
31+
32+
# allow-branch HEAD is because GitHub actions switches
33+
# to the tag while building, which is a detached head
34+
35+
# Publishing is currently messy, because:
36+
#
37+
# * `peace_rt_model_core` exports `NativeError` or `WebError` depending on the target.
38+
# * `peace_rt_model_web` fails to build when publishing the workspace for a native target.
39+
# * `peace_rt_model_web` still needs its dependencies to be published before it can be
40+
# published.
41+
# * `peace_rt_model_hack` needs `peace_rt_model_web` to be published before it can be
42+
# published.
43+
#
44+
# We *could* pass through `--no-verify` so `cargo` doesn't build the crate before publishing,
45+
# which is reasonable, since this job only runs after the Linux, Windows, and WASM builds
46+
# have passed.
47+
- name: "cargo release publish"
48+
run: |-
49+
cargo release \
50+
publish \
51+
--workspace \
52+
--all-features \
53+
--allow-branch HEAD \
54+
--no-confirm \
55+
--no-verify \
56+
--execute
57+

0 commit comments

Comments
 (0)