-
Notifications
You must be signed in to change notification settings - Fork 13
84 lines (77 loc) · 2.52 KB
/
release-prometheus-process.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
name: Release kubernetes-prometheus-process
on:
pull_request:
paths:
- .github/workflows/release-prometheus-process.yml
push:
tags:
- 'kubert-prometheus-process/*'
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
permissions:
contents: read
jobs:
cleanup:
runs-on: ubuntu-latest
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-latest
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- id: meta
shell: bash
run: |
ref="${{ github.ref }}"
if [[ "$ref" == refs/tags/kubert-prometheus-process/* ]]; then
version="${ref##refs/tags/kubert-prometheus-process/}"
crate=$(just-cargo crate-version kubert-prometheus-process)
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-process)-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-latest
steps:
- if: needs.meta.outputs.mode == 'release'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
with:
name: kubert-prometheus-process ${{ 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-latest
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- run: cargo publish --package=kubert-prometheus-process --dry-run
- if: needs.meta.outputs.mode == 'release'
run: cargo publish --package=kubert-prometheus-process --token=${{ secrets.CRATESIO_TOKEN }}