Repository navigation
198 lines (188 loc) · 6.94 KB
/
Copy pathrelease.yml
File metadata and controls
198 lines (188 loc) · 6.94 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Release & Deploy to Clojars
on:
push:
tags: ['v[0-9]*']
workflow_dispatch:
inputs:
tag:
description: Existing unpublished vX.Y.Z tag to recover without moving it
type: string
required: true
source_run:
description: Original release run with green source, macOS, mobile and desktop checks
type: string
required: true
native_run:
description: Successful Linux recovery run from native-release.yml for the same tag
type: string
required: true
permissions:
contents: write
concurrency:
group: release-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
jobs:
verify:
name: Verify release source
needs: prepare
uses: ./.github/workflows/ci.yml
with:
verify-tla: true
secrets: inherit
prepare:
# Validate immutable source before starting checks and draft-only native builds.
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
fetch-depth: 0
# A commit pushed to main after the tag does not stop the release.
- name: Verify the tag, VIS_VERSION and that main contains the tag
run: |
set -euo pipefail
test "$RELEASE_TAG" = "v$(tr -d '[:space:]' < VIS_VERSION)"
test "$(git rev-parse "$RELEASE_TAG^{commit}")" = "$(git rev-parse HEAD)"
git merge-base --is-ancestor HEAD origin/main
- name: Prepare unpublished release
run: |
set -euo pipefail
if ! gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
gh release create "$RELEASE_TAG" \
--verify-tag --draft --title "$RELEASE_TAG" --generate-notes
fi
- uses: ./.github/actions/require-draft-release
with:
tag: ${{ github.ref_name }}
- name: Upload installers to the verified draft
run: gh release upload "$RELEASE_TAG" bin/install-vis-agent bin/vis-agent --clobber
native:
# Native artifacts remain private drafts until source and product gates pass.
needs: prepare
permissions:
contents: write
actions: read
uses: ./.github/workflows/native-release.yml
with:
tag: ${{ github.ref_name }}
only: all
secrets: inherit
mobile:
needs: [prepare, verify]
uses: ./.github/workflows/mobile-release.yml
with:
platforms: both
track: all
audience: all
require_complete: true
secrets: inherit
desktop:
needs: [prepare, verify]
permissions:
contents: write
id-token: write
uses: ./.github/workflows/desktop-companion.yml
with:
tag: ${{ github.ref_name }}
secrets: inherit
recover:
name: Verify original product gates and repaired Linux checks
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
actions: read
outputs:
sha: ${{ steps.verify.outputs.sha }}
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.tag }}
SOURCE_RUN: ${{ inputs.source_run }}
NATIVE_RUN: ${{ inputs.native_run }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/require-draft-release
id: release
with:
tag: ${{ inputs.tag }}
- name: Verify recovery without moving the tag or resubmitting mobile builds
id: verify
env:
RELEASE_METADATA: ${{ steps.release.outputs.metadata }}
run: |
set -euo pipefail
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
sha=$(git rev-parse "$RELEASE_TAG^{commit}")
git merge-base --is-ancestor "$sha" HEAD
test "$RELEASE_TAG" = "v$(git show "$sha:VIS_VERSION" | tr -d '[:space:]')"
python3 bin/verify-release-assets.py "$RELEASE_METADATA" "$RELEASE_TAG" \
--source-run "$SOURCE_RUN" --native-run "$NATIVE_RUN" --sha "$sha"
printf 'sha=%s\n' "$sha" >> "$GITHUB_OUTPUT"
publish:
name: Verify complete assets, deploy libraries and publish stable
needs: [prepare, verify, native, mobile, desktop, recover]
if: >-
!cancelled() &&
((github.event_name == 'push' && needs.prepare.result == 'success' &&
needs.verify.result == 'success' &&
needs.native.result == 'success' && needs.mobile.result == 'success' &&
needs.desktop.result == 'success') ||
(github.event_name == 'workflow_dispatch' && needs.recover.result == 'success'))
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # Sigstore signs with the OIDC identity of this workflow
attestations: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.recover.outputs.sha || github.sha }}
- uses: ./.github/actions/require-draft-release
id: release
with:
tag: ${{ inputs.tag || github.ref_name }}
- name: Require every verified product artifact
env:
RELEASE_METADATA: ${{ steps.release.outputs.metadata }}
run: python3 bin/verify-release-assets.py "$RELEASE_METADATA" "$RELEASE_TAG"
- uses: ./.github/actions/setup-graalvm-25
- uses: ./.github/actions/setup-clojure
- name: Deploy monorepo packages to Clojars
env:
CLOJARS_USERNAME: blockether-deployer
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_DEPLOY_TOKEN }}
run: |
set -euo pipefail
VERSION="${RELEASE_TAG#v}"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
"https://repo.clojars.org/com/blockether/vis/$VERSION/vis-$VERSION.jar")
case "$STATUS" in
200) echo "Version $VERSION already deployed; resuming draft publication" ;;
404) bin/prepare-jvm :all true && clojure -T:build deploy ;;
*) echo "Cannot verify Clojars version (HTTP $STATUS)" >&2; exit 1 ;;
esac
# Installers verify every download against this file (#332).
- name: Publish SHA256SUMS of every asset
env:
RELEASE_METADATA: ${{ steps.release.outputs.metadata }}
run: |
set -euo pipefail
python3 bin/release-checksums.py "$RELEASE_METADATA" "$RUNNER_TEMP/SHA256SUMS"
gh release upload "$RELEASE_TAG" "$RUNNER_TEMP/SHA256SUMS" --clobber
# `gh attestation verify <file> --repo Blockether/vis` checks this provenance (#435).
- name: Attest every asset with Sigstore
uses: actions/attest-build-provenance@v4
with:
subject-checksums: ${{ runner.temp }}/SHA256SUMS
- name: Publish complete stable release
run: gh release edit "$RELEASE_TAG" --draft=false --latest