-
Notifications
You must be signed in to change notification settings - Fork 182
34 lines (33 loc) · 1.18 KB
/
crates-release.yml
File metadata and controls
34 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# See https://crates.io/docs/trusted-publishing
name: Publish to crates.io
on:
push:
tags: ['v*']
workflow_dispatch: {}
jobs:
publish:
runs-on: ubuntu-24.04
permissions:
id-token: write # Required for OIDC token exchange
steps:
- uses: actions/checkout@v6
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: |
# Publish crates if their current version is not already on crates.io.
# Order matters: dependencies must be published first.
CRATES="utils mount blockdev"
for dir in $CRATES; do
manifest="crates/$dir/Cargo.toml"
crate=$(cargo read-manifest --manifest-path "$manifest" | jq -r '.name')
VERSION=$(cargo read-manifest --manifest-path "$manifest" | jq -r '.version')
if cargo info --registry crates-io "$crate@$VERSION" > /dev/null 2>&1; then
echo "$crate@$VERSION is already published, skipping"
else
echo "Publishing $crate@$VERSION..."
cargo publish -p "$crate"
echo "Successfully published $crate@$VERSION"
fi
done
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}