...
1name: release
2
3on:
4 pull_request:
5 paths:
6 - justfile
7 - .github/workflows/release.yml
8 push:
9 tags:
10 - 'v*'
11
12env:
13 CARGO_INCREMENTAL: 0
14 CARGO_NET_RETRY: 10
15 RUSTUP_MAX_RETRIES: 10
16
17permissions:
18 contents: read
19
20jobs:
21 meta:
22 timeout-minutes: 5
23 runs-on: ubuntu-latest
24 steps:
25 - id: meta
26 shell: bash
27 run: |
28 ref='${{ github.ref }}'
29 if [[ "$ref" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
30 echo publish=true >> "$GITHUB_OUTPUT"
31 echo version="${ref##refs/tags/}" >> "$GITHUB_OUTPUT"
32 else
33 sha=${{ github.sha }}
34 echo version="test-${sha:0:7}" >> "$GITHUB_OUTPUT"
35 fi
36 outputs:
37 publish: ${{ steps.meta.outputs.publish }}
38 version: ${{ steps.meta.outputs.version }}
39
40 test:
41 timeout-minutes: 5
42 runs-on: ubuntu-latest
43 container: docker://ghcr.io/linkerd/dev:v43-rust
44 steps:
45 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
46 - run: just rs-fetch
47 - run: just rs-gen-check
48 - run: just rs-test-build
49 - run: just rs-test
50
51 # Publish a GitHub release with platform-specific static binaries.
52 release:
53 needs: [meta, test]
54 permissions:
55 contents: write
56 timeout-minutes: 5
57 runs-on: ubuntu-latest
58 container: docker://ghcr.io/linkerd/dev:v43-rust
59 steps:
60 - if: needs.meta.outputs.publish
61 uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
62 - if: needs.meta.outputs.publish
63 shell: bash
64 run: |
65 version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "linkerd2-proxy-api") | .version')
66 expected='${{ needs.meta.outputs.version }}'
67 if [[ "v${version}" != "$expected" ]]; then
68 echo "::error ::Crate version v${version} does not match tag $expected"
69 exit 1
70 fi
71 - if: needs.meta.outputs.publish
72 uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
73 with:
74 name: ${{ needs.meta.outputs.version }}
75 generate_release_notes: true
76
77 crate:
78 # Only publish the crate after the rest of the release succeeds.
79 needs: [meta, release]
80 timeout-minutes: 10
81 runs-on: ubuntu-latest
82 container: docker://ghcr.io/linkerd/dev:v43-rust
83 steps:
84 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
85 - if: '!needs.meta.outputs.publish'
86 run: just rs-publish --dry-run
87 - if: needs.meta.outputs.publish
88 run: just rs-publish --token=${{ secrets.CRATESIO_TOKEN }}
View as plain text