-
Notifications
You must be signed in to change notification settings - Fork 14
87 lines (80 loc) · 2.59 KB
/
release-prometheus-tokio.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Release kubernetes-prometheus-tokio
on:
pull_request:
paths:
- .github/workflows/release-prometheus-tokio.yml
push:
tags:
- 'kubert-prometheus-tokio/*'
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
permissions:
contents: read
jobs:
cleanup:
runs-on: ubuntu-24.04
permissions:
actions: write
steps:
- uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa
with:
all_but_latest: true
access_token: ${{ github.token }}
meta:
timeout-minutes: 5
runs-on: ubuntu-24.04
container: ghcr.io/linkerd/dev:v45-rust
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- id: meta
shell: bash
run: |
ref="${{ github.ref }}"
if [[ "$ref" == refs/tags/kubert-prometheus-tokio/* ]]; then
version="${ref##refs/tags/kubert-prometheus-tokio/}"
crate=$(just-cargo crate-version kubert-prometheus-tokio)
if [[ "$crate" != "$version" ]]; then
echo "::error ::Crate version $crate does not match tag $version" >&2
exit 1
fi
( echo version="$version"
echo mode=release
) >> "$GITHUB_OUTPUT"
else
sha="${{ github.sha }}"
( echo version="$(just-cargo crate-version kubert-prometheus-tokio)-git-${sha:0:7}"
echo mode=test
) >> "$GITHUB_OUTPUT"
fi
outputs:
mode: ${{ steps.meta.outputs.mode }}
version: ${{ steps.meta.outputs.version }}
release:
needs: [meta]
permissions:
contents: write
timeout-minutes: 5
runs-on: ubuntu-24.04
steps:
- if: needs.meta.outputs.mode == 'release'
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
with:
name: kubert-prometheus-tokio ${{ needs.meta.outputs.version }}
generate_release_notes: false
make_latest: false
crate:
# Only publish the crate after the rest of the release succeeds.
needs: [meta, release]
timeout-minutes: 10
runs-on: ubuntu-24.04
container: ghcr.io/linkerd/dev:v45-rust
env:
RUSTFLAGS: '--cfg tokio_unstable'
RUSTDOCFLAGS: '--cfg tokio_unstable'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: cargo publish --package=kubert-prometheus-tokio --dry-run
- if: needs.meta.outputs.mode == 'release'
run: cargo publish --package=kubert-prometheus-tokio --token=${{ secrets.CRATESIO_TOKEN }}