Skip to content

Commit bb8cec3

Browse files
authored
Automate cargo crates release naively (#41)
This implements a barebones `cargo publish` on merge to `main` that will fail if we don't manually update the version. There are more sophisticated solutions involving `cargo release`, but this suffices for our needs.
1 parent b03be01 commit bb8cec3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/pullrequest.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,38 @@ jobs:
5656
- run: cargo fmt --all -- --check
5757
- run: cargo doc --all --exclude plexi-cli --all-features --document-private-items
5858
- run: cargo test --all --verbose --exclude plexi-cli --all-features
59+
60+
deploy-rust:
61+
name: Deploy Rust Crates
62+
timeout-minutes: 5
63+
env:
64+
# This token can be regenerated by visiting https://crates.io/me,
65+
# generating a new API token with `publish-update` permissions,
66+
# scoping it to just `web-bot-auth` and `http-signature-directory`
67+
# crates, and uploading to Github.
68+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
69+
strategy:
70+
matrix:
71+
os: [ubuntu-24.04]
72+
runs-on: ${{ matrix.os }}
73+
if: ${{ github.ref == 'refs/heads/main' }}
74+
needs:
75+
- "test-rust"
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 1
80+
- name: Cache
81+
uses: actions/cache@v4
82+
with:
83+
path: |
84+
~/.cargo/registry
85+
~/.cargo/git
86+
target
87+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
88+
- name: Set rust toolchain
89+
run: rustup override set 1.87
90+
- run: cargo publish -p web-bot-auth # will fail if we don't bump the version
91+
continue-on-error: true
92+
- run: cargo publish -p http-signature-directory # will fail if we don't bump the version
93+
continue-on-error: true

0 commit comments

Comments
 (0)