-
Notifications
You must be signed in to change notification settings - Fork 416
47 lines (41 loc) · 1.18 KB
/
rust_release.yml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Release to Cargo
on:
push:
tags: ["rust-v*"]
defaults:
run:
working-directory: ./rust
jobs:
validate-release-tag:
name: Validate git tag
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: compare git tag with cargo metadata
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "rust-v${CURR_VER}" ]]; then
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
release-crate:
needs: validate-release-tag
name: Release crate
strategy:
fail-fast: false
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: cargo publish
uses: actions-rs/cargo@v1
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
command: publish
args: --token "${CARGO_REGISTRY_TOKEN}" --manifest-path ./rust/Cargo.toml