-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (56 loc) · 1.32 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
on:
release:
types:
- prereleased
- released
name: Release
env:
TAG: ${{ github.event.release.tag_name }}
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Version
run: |
set -ex
cargo_version="$(sed -n 's/^version\s*=\s*"\(.*\)"\s*$/\1/p' Cargo.toml)"
test "$cargo_version" = "${TAG#v}"
test:
name: Test
needs: check-version
uses: ./.github/workflows/test.yml
publish:
name: Publish
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: protoc,sccache
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Package
run: |
cargo package
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish
failure:
needs: [check-version, test, publish]
if: cancelled() || failure()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Remove tag
run: |
git push --delete origin "$TAG"