-
-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (63 loc) · 2.02 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
63
name: Release
on:
push:
tags: ['v*']
jobs:
validate:
name: Validate Release
strategy:
matrix:
os: [ubuntu, windows, macos]
runs-on: ${{matrix.os}}-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Rust Toolchain
uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1
with:
bins: cargo-hack
- name: Validate Publish
run: cargo hack publish --dry-run --each-feature --locked
publish:
needs: [validate]
name: Publish Crate
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set Git Branch
run: git switch -c ${{github.ref_name}}
- name: Install Cargo Release
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3
with:
crate: cargo-release
- name: Get Crate Version
shell: bash
id: metadata
run: |
declare query='.packages[] | select(.name | contains("outcome")).version'
echo "::set-output name=version::$(cargo metadata --format-version=1 | jq -r "${query}")"
- name: Verify Version
run: test "v${{steps.metadata.outputs.version}}" = "${{github.ref_name}}"
- name: Configure Git User
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Publish Crate
run: >-
cargo release
--token ${{secrets.CARGO_REGISTRY_TOKEN}}
--tag-name ${{github.ref_name}}
--no-confirm
--no-verify
--no-push
--no-tag
--execute
- name: Yank On Failure
shell: bash
if: failure()
run: >-
cargo yank
--vers ${{steps.metadata.outputs.version}}
--token ${{secrets.CARGO_REGISTRY_TOKEN}}