-
Notifications
You must be signed in to change notification settings - Fork 32
324 lines (287 loc) · 10.5 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Create Release
# Run for new release tags only
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GHCR: ghcr.io/${{ github.repository }}
jobs:
lint:
name: Golang CI Lint
uses: burnt-labs/xion/.github/workflows/golangci-lint.yml@main
secrets: inherit
update-swagger:
name: Update Swagger
uses: burnt-labs/xion/.github/workflows/update-swagger.yml@main
secrets: inherit
unit-tests:
name: Go Unit Tests
uses: burnt-labs/xion/.github/workflows/tests.yml@main
secrets: inherit
build-docker:
name: Build Docker Images
uses: burnt-labs/xion/.github/workflows/docker-build.yml@main
secrets: inherit
push-docker:
needs: build-docker
name: Heighliner Build
uses: burnt-labs/xion/.github/workflows/docker-push.yml@main
secrets: inherit
docker-scout:
needs: build-docker
name: Docker Scout
uses: burnt-labs/xion/.github/workflows/docker-scout.yml@main
secrets: inherit
interchain-tests:
needs: build-docker
name: Interchain tests
uses: burnt-labs/xion/.github/workflows/integration-tests.yml@main
secrets: inherit
build-release-info:
runs-on: ubuntu-latest
needs: build-docker
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Prepare environment
run: mkdir -p release
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: xiond-*
merge-multiple: true
- name: Create binaries.json
working-directory: release
id: binaries-json
run: |
set -Eeuo pipefail
ls xiond-* | while read -r file; do
platform=$(echo $file | cut -d- -f3- | sed -E 's/^rc[0-9]*-//g; s/\//-/g')
checksum=$(sha256sum "$file" | awk '{ print $1 }')
echo "$platform: https://github.com/burnt-labs/xion/releases/download/${{ github.ref_name }}/$file?checksum=sha256:$checksum"
done | yq '{"binaries": .}' -o json | tee binaries.json
- name: Upload binaries.json file
uses: actions/upload-artifact@v4
with:
name: binaries.json
path: release/binaries.json
retention-days: 1
- name: Create version.json
working-directory: release
run : |
set -Eeuo pipefail
upgrade_name=$(echo $GITHUB_REF_NAME | cut -d. -f1)
jq -s '.[0] * .[1]' <(go mod edit -json | jq --arg name $upgrade_name '{
name: $name,
tag: "${{ github.ref_name }}",
height: 0,
proposal: 0,
go_version: .Go,
cosmos_sdk_version: (.Require[] | select(.Path == "github.com/cosmos/cosmos-sdk") | .Version),
cosmwasm_enabled: (.Require[] | select(.Path == "github.com/CosmWasm/wasmd") != null),
cosmwasm_version: (.Require[] | select(.Path == "github.com/CosmWasm/wasmd") | .Version),
ibc_go_version: (.Require[] | select(.Path == "github.com/cosmos/ibc-go/v7") | .Version),
consensus: {
type: "cometbft",
version: (.Require[] | select(.Path == "github.com/cometbft/cometbft") | .Version)
}
}') binaries.json | tee version.json
- name: Upload version.json files
uses: actions/upload-artifact@v4
with:
name: version.json
path: release/version.json
retention-days: 1
build-release:
needs:
- lint
- update-swagger
- unit-tests
- docker-scout
- interchain-tests
- build-release-info
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Create release directory
run: mkdir -p release
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Output Changelog
run: echo "${{steps.changelog.outputs.changelog}}"
- name: Create release for ${{ github.ref_name }}
id: update-release
uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
allowUpdates: true
body: ${{ steps.changelog.outputs.changelog }}
draft: false
generateReleaseNotes: true
prerelease: true
removeArtifacts: false # important, true will remove src archives
tag: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
updateOnlyUnreleased: true
- name: Download release archives
working-directory: release
run: |
gh release download ${{ github.ref_name }} \
--repo=${{ github.repository }} \
--archive=tar.gz
gh release download ${{ github.ref_name }} \
--repo=${{ github.repository }} \
--archive=zip
ls
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: xiond-${{ github.ref_name }}-*
merge-multiple: true
- name: Create checksums
working-directory: release
run: |
sha256sum * | tee checksum.txt
- name: Remove release archives
working-directory: release
run: |
rm -f *.zip *.tar.gz
ls
- name: Upload release assets
working-directory: release
run: |
gh release upload ${{ github.ref_name }} * \
--repo ${{ github.repository }} \
--clobber
update-networks:
runs-on: ubuntu-latest
needs:
- build-release
- build-release-info
permissions:
contents: write
steps:
- name: Prepare environment
run: |
BASE_PATH=testnets/xion-testnet-1
BINARIES_PATH=${BASE_PATH}/governance-proposals/software-upgrades/binaries
METADATA_PATH=${BASE_PATH}/governance-proposals/software-upgrades/metadata
PROPOSAL_PATH=${BASE_PATH}/governance-proposals/software-upgrades/proposal
UPGRADE_NAME=$(echo ${GITHUB_REF_NAME} | cut -d. -f1)
echo "BASE_PATH=${BASE_PATH}" | tee -a ${GITHUB_ENV}
echo "BINARIES_PATH=${BINARIES_PATH}" | tee -a ${GITHUB_ENV}
echo "METADATA_PATH=${METADATA_PATH}" | tee -a ${GITHUB_ENV}
echo "PROPOSAL_PATH=${PROPOSAL_PATH}" | tee -a ${GITHUB_ENV}
echo "UPGRADE_NAME=${UPGRADE_NAME}" | tee -a ${GITHUB_ENV}
echo "NETWORKS_REPO=burnt-labs/burnt-networks" | tee -a ${GITHUB_ENV}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
name: id_ed25519
key: ${{ secrets.BURNT_NETWORKS_SSH_KEY }}
known_hosts: |
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
- name: Check out code (use ssh)
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git clone [email protected]:${{ env.NETWORKS_REPO }}.git ./
- name: Download json artifacts
uses: actions/download-artifact@v4
with:
pattern: '*.json'
path: /tmp
merge-multiple: true
- name: Rename binaries.json
working-directory: ${{ env.BINARIES_PATH }}
run: |
cp /tmp/binaries.json ${UPGRADE_NAME}.json
- name: Add version to chain.json
run: |
set -Eeuo pipefail
CHAIN_JSON=${BASE_PATH}/chain-registry/chain.json
VERSION_JSON=/tmp/version.json
cp ${CHAIN_JSON} /tmp/chain.json
jq --slurpfile version ${VERSION_JSON} '
.codebase.versions |= (
map(
if .name == $version[0].name then
($version[0] + {height: .height, proposal: .proposal})
else
.
end
) +
if any(.[]; .name == $version[0].name) then [] else $version end
)
' /tmp/chain.json | tee ${CHAIN_JSON}
- name: Add metadata json
working-directory: ${{ env.METADATA_PATH }}
run: |
set -Eeuo pipefail
[[ -f ${UPGRADE_NAME}.json ]] || \
jq -n --arg version ${UPGRADE_NAME} '{
title: "Software Upgrade \($version)",
authors: [
],
summary: "Software Upgrade \($version)",
details: "Software Upgrade \($version) at block height <TBD>",
proposal_forum_url: "",
vote_option_context: "YES to approve the upgrade, NO to reject the upgrade."
}' | tee ${UPGRADE_NAME}.json
- name: Add proposal json
working-directory: ${{ env.PROPOSAL_PATH }}
run: |
set -Eeuo pipefail
[[ -f ${UPGRADE_NAME}.json ]] || \
jq -n \
--arg version ${UPGRADE_NAME} \
--arg binaries_url https://raw.githubusercontent.com/${NETWORKS_REPO}/main/${BINARIES_PATH}/${UPGRADE_NAME}.json \
--arg metadata_url https://raw.githubusercontent.com/${NETWORKS_REPO}/main/${METADATA_PATH}/${UPGRADE_NAME}.json \
'{
messages: [
{
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
authority: "xion10d07y265gmmuvt4z0w9aw880jnsr700jctf8qc",
plan: {
name: $version,
height: "<TBD>",
info: $binaries_url,
upgraded_client_state: null
}
}
],
metadata: $metadata_url,
deposit: "10000000uxion",
title: "Software Upgrade \($version)",
summary: "Software Upgrade \($version)"
}' | tee ${UPGRADE_NAME}.json
- name: Create PR
env:
GH_TOKEN: ${{ github.token }}
run: |
git add -A
git commit --message "Update for xion release ${{ github.ref_name }}"
echo "Pushing git commit"
git push -f -u origin "HEAD:release/${{ github.ref_name }}"
git checkout "release/${{ github.ref_name }}"
# echo "Creating a pull request"
# git request-pull main origin release/v9.0.1-rc2
# gh pr create -B main \
# -H release/${{ github.ref_name }} \
# -t release/${{ github.ref_name }} \
# -b release/${{ github.ref_name }} \
# -r 2xburnt