Skip to content

Commit a6908a2

Browse files
wehappyfewKostas Demiris2xburnt
committed
Feat: DO64 - update chain registry on release (#14)
* test the workflow trigger * test the workflow trigger * test the workflow trigger * test the PR for the updated versions.json * added step to update the mainnet versions.json * fixed test cat at the end of the steps * ready for PR * modify workflow * rebase --------- Co-authored-by: Kostas Demiris <[email protected]> Co-authored-by: TwiceBurnt <[email protected]>
1 parent f1250d3 commit a6908a2

File tree

7 files changed

+151
-27
lines changed

7 files changed

+151
-27
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Update Chain Registry Versions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_info:
7+
description: "Version information in JSON format"
8+
required: true
9+
type: string
10+
workflow_call:
11+
inputs:
12+
version_info:
13+
description: "Version information in JSON format"
14+
required: true
15+
type: string
16+
17+
jobs:
18+
update-versions:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
strategy:
24+
matrix:
25+
network:
26+
- name: testnet
27+
versions_file: "public/chain-registry/testnets/xiontestnet2/versions.json"
28+
chain_file: "public/chain-registry/testnets/xiontestnet2/chain.json"
29+
- name: mainnet
30+
versions_file: "public/chain-registry/xion/versions.json"
31+
chain_file: "public/chain-registry/xion/chain.json"
32+
33+
steps:
34+
- name: Check out code
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0 # Ensure we can create branches
38+
39+
- name: Extract version name
40+
id: version_info
41+
run: |
42+
# Set variables using heredoc
43+
VERSION_INFO='${{ inputs.version_info }}'
44+
VERSION_TAG=$(echo "$VERSION_INFO" | jq -r '.tag')
45+
VERSION_NAME=$(echo "$VERSION_INFO" | jq -r '.name')
46+
VERSIONS_FILE="${{ matrix.network.versions_file }}"
47+
CHAIN_FILE="${{ matrix.network.chain_file }}"
48+
NEW_BRANCH="upgrade/${{ matrix.network.name }}-$VERSION_TAG"
49+
50+
51+
echo "VERSION_INFO=$VERSION_INFO" >> $GITHUB_ENV
52+
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
53+
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
54+
echo "CHAIN_FILE=$CHAIN_FILE" >> $GITHUB_ENV
55+
echo "VERSIONS_FILE=$VERSIONS_FILE" >> $GITHUB_ENV
56+
echo "NEW_BRANCH=$NEW_BRANCH" >> $GITHUB_ENV
57+
58+
- name: Create new branch
59+
run: |
60+
# Check if the branch already exists
61+
if git show-ref --verify --quiet "refs/heads/${NEW_BRANCH}"; then
62+
git checkout ${NEW_BRANCH}
63+
else
64+
git checkout -b $NEW_BRANCH
65+
git push --set-upstream origin $NEW_BRANCH
66+
fi
67+
68+
- name: Update file ${{ matrix.network.versions_file }}
69+
id: update_version_json
70+
run: |
71+
# Check if version already exists and update or append
72+
if jq -e --arg name "$VERSION_NAME" '.versions[] | select(.name == $name)' "$VERSIONS_FILE" > /dev/null; then
73+
echo "Version $VERSION_NAME already exists, updating..."
74+
jq --arg name "$VERSION_NAME" --argjson new "$VERSION_INFO" '
75+
.versions = (.versions | map(if .name == $name then ($new + .) else . end))
76+
' "$VERSIONS_FILE" > "$VERSIONS_FILE.tmp" && mv "$VERSIONS_FILE.tmp" "$VERSIONS_FILE"
77+
else
78+
echo "Version $VERSION_NAME does not exist, appending..."
79+
jq --arg name "$VERSION_NAME" --argjson new "$VERSION_INFO" '
80+
.versions += [$new]
81+
' "$VERSIONS_FILE" > "$VERSIONS_FILE.tmp" && mv "$VERSIONS_FILE.tmp" "$VERSIONS_FILE"
82+
fi
83+
84+
- name: Update file ${{ matrix.network.chain_file }}
85+
run: |
86+
# Update chain.json
87+
echo "Updating chain.json for version: $VERSION_NAME"
88+
jq --arg name "$VERSION_NAME" --argjson new "$VERSION_INFO" '
89+
.codebase = (.codebase | map(if .name == $name then ($new | with_entries(select(.key | IN(keys_unsorted(.)))) + .) else . end))
90+
' "$CHAIN_FILE" > "$CHAIN_FILE.tmp" && mv "$CHAIN_FILE.tmp" "$CHAIN_FILE"
91+
cat "$CHAIN_FILE"
92+
93+
- name: Commit changes
94+
id: commit_changes
95+
uses: pirafrank/github-commit-sign@v0
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
COMMIT_MESSAGE: "upgrade: upgrade ${{ matrix.network.name }} to ${{ steps.extract_version.outputs.VERSION_TAG }} in versions.json and chain.json"
99+
with:
100+
args: |
101+
commit \
102+
--owner=${{ github.repository_owner }} \
103+
--repo=${{ github.event.repository.name }} \
104+
--branch=${{ env.NEW_BRANCH }} \
105+
--commitMessage='${{ env.COMMIT_MESSAGE }}' \
106+
--changed="${{ matrix.network.chain_file }}" \
107+
--changed="${{ matrix.network.versions_file}}"
108+
109+
- name: Create Pull Request - ${{ matrix.network.name }}
110+
env:
111+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
run: |
113+
gh pr create \
114+
--base main \
115+
--title "upgrade: upgrade ${{ env.VERSION_TAG }} to ${{ matrix.network.name }} chain registry" \
116+
--body "Updates ${{ matrix.network.name }} versions.json and chain.json with ${{ env.VERSION_TAG }} release information" \
117+
--head "upgrade/${{ matrix.network.name }}-${{ env.VERSION_TAG }}" \
118+
--reviewer "2xburnt" \
119+
--reviewer "wehappyfew"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ coverage
3232
# wrangler files
3333
.wrangler
3434
.dev.vars*
35+
36+
37+
# github workflows
38+
.github/workflows/test_workflow.yaml

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"prebuild": "node scripts/generate-list.js",
98
"build": "run-p type-check \"build-only {@}\" --",
109
"preview": "npm run build && wrangler dev",
1110
"build-only": "vite build",

public/chain-registry/testnets/xiontestnet2/chain.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@
4242
},
4343
"codebase": {
4444
"git_repo": "https://github.com/burnt-labs/xion",
45-
"tag": "v19.0.1",
46-
"recommended_version": "v19.0.1",
45+
"tag": "v19.0.2",
46+
"recommended_version": "v19.0.2",
4747
"language": {
4848
"type": "go",
4949
"version": "v1.23"
5050
},
5151
"binaries": {
52-
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_amd64.tar.gz?checksum=sha256:f350e2ab0cc08c18acce0d6518bd4f29ac88f1c331eb10d3ca43ec3e74103521",
53-
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_arm64.tar.gz?checksum=sha256:9c2944de98c54f4e8517259d0782daca4c43900887b7d7c19044ba75b6e2976d",
54-
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_amd64.tar.gz?checksum=sha256:5350ccf4fb83f086f772ceebd8a1c3788c2fa64ad1976d92052842e23a1977c3",
55-
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_arm64.tar.gz?checksum=sha256:efed79d4b240c6edaa4488b54e7efcbff89313c0f0ed6e1682dab0f1d97315c2"
52+
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_amd64.tar.gz?checksum=sha256:edda13aec2274f1eceb933874a885d055b14acbbe0de21ba61ed9c25c64813d6",
53+
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_arm64.tar.gz?checksum=sha256:7b94d2fdf1baa1d3dff4f947858a2bac684257be27f8bf179fb973ee8dd4fdb8",
54+
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_amd64.tar.gz?checksum=sha256:6072ce81d08f77f98e2d2ae7726007eca18579ea2b1690b5f76b4df782690dcb",
55+
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_arm64.tar.gz?checksum=sha256:0a55360653b596da5ace43c3b4a3fef6c9785bfe0e73405f591768b449af0e70"
5656
},
5757
"sdk": {
5858
"type": "cosmos",

public/chain-registry/testnets/xiontestnet2/versions.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@
188188
},
189189
{
190190
"name": "v19",
191-
"tag": "v19.0.1",
192-
"recommended_version": "v19.0.1",
191+
"tag": "v19.0.2",
192+
"recommended_version": "v19.0.2",
193193
"compatible_versions": [
194-
"v19.0.1"
194+
"v19.0.1",
195+
"v19.0.2"
195196
],
196197
"height": 7420000,
197198
"proposal": 37,
@@ -200,10 +201,10 @@
200201
"version": "v1.23"
201202
},
202203
"binaries": {
203-
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_amd64.tar.gz?checksum=sha256:f350e2ab0cc08c18acce0d6518bd4f29ac88f1c331eb10d3ca43ec3e74103521",
204-
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_arm64.tar.gz?checksum=sha256:9c2944de98c54f4e8517259d0782daca4c43900887b7d7c19044ba75b6e2976d",
205-
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_amd64.tar.gz?checksum=sha256:5350ccf4fb83f086f772ceebd8a1c3788c2fa64ad1976d92052842e23a1977c3",
206-
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_arm64.tar.gz?checksum=sha256:efed79d4b240c6edaa4488b54e7efcbff89313c0f0ed6e1682dab0f1d97315c2"
204+
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_amd64.tar.gz?checksum=sha256:edda13aec2274f1eceb933874a885d055b14acbbe0de21ba61ed9c25c64813d6",
205+
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_arm64.tar.gz?checksum=sha256:7b94d2fdf1baa1d3dff4f947858a2bac684257be27f8bf179fb973ee8dd4fdb8",
206+
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_amd64.tar.gz?checksum=sha256:6072ce81d08f77f98e2d2ae7726007eca18579ea2b1690b5f76b4df782690dcb",
207+
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_arm64.tar.gz?checksum=sha256:0a55360653b596da5ace43c3b4a3fef6c9785bfe0e73405f591768b449af0e70"
207208
},
208209
"sdk": {
209210
"type": "cosmos",

public/chain-registry/xion/chain.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@
4242
},
4343
"codebase": {
4444
"git_repo": "https://github.com/burnt-labs/xion",
45-
"tag": "v19.0.1",
46-
"recommended_version": "v19.0.1",
45+
"tag": "v19.0.2",
46+
"recommended_version": "v19.0.2",
4747
"language": {
4848
"type": "go",
4949
"version": "v1.23"
5050
},
5151
"binaries": {
52-
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_amd64.tar.gz?checksum=sha256:f350e2ab0cc08c18acce0d6518bd4f29ac88f1c331eb10d3ca43ec3e74103521",
53-
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_arm64.tar.gz?checksum=sha256:9c2944de98c54f4e8517259d0782daca4c43900887b7d7c19044ba75b6e2976d",
54-
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_amd64.tar.gz?checksum=sha256:5350ccf4fb83f086f772ceebd8a1c3788c2fa64ad1976d92052842e23a1977c3",
55-
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_arm64.tar.gz?checksum=sha256:efed79d4b240c6edaa4488b54e7efcbff89313c0f0ed6e1682dab0f1d97315c2"
52+
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_amd64.tar.gz?checksum=sha256:edda13aec2274f1eceb933874a885d055b14acbbe0de21ba61ed9c25c64813d6",
53+
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_arm64.tar.gz?checksum=sha256:7b94d2fdf1baa1d3dff4f947858a2bac684257be27f8bf179fb973ee8dd4fdb8",
54+
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_amd64.tar.gz?checksum=sha256:6072ce81d08f77f98e2d2ae7726007eca18579ea2b1690b5f76b4df782690dcb",
55+
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_arm64.tar.gz?checksum=sha256:0a55360653b596da5ace43c3b4a3fef6c9785bfe0e73405f591768b449af0e70"
5656
},
5757
"sdk": {
5858
"type": "cosmos",

public/chain-registry/xion/versions.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,11 @@
337337
},
338338
{
339339
"name": "v19",
340-
"tag": "v19.0.1",
341-
"recommended_version": "v19.0.1",
340+
"tag": "v19.0.2",
341+
"recommended_version": "v19.0.2",
342342
"compatible_versions": [
343-
"v19.0.1"
343+
"v19.0.1",
344+
"v19.0.2"
344345
],
345346
"height": 9150000,
346347
"proposal": 40,
@@ -349,10 +350,10 @@
349350
"version": "v1.23"
350351
},
351352
"binaries": {
352-
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_amd64.tar.gz?checksum=sha256:f350e2ab0cc08c18acce0d6518bd4f29ac88f1c331eb10d3ca43ec3e74103521",
353-
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_darwin_arm64.tar.gz?checksum=sha256:9c2944de98c54f4e8517259d0782daca4c43900887b7d7c19044ba75b6e2976d",
354-
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_amd64.tar.gz?checksum=sha256:5350ccf4fb83f086f772ceebd8a1c3788c2fa64ad1976d92052842e23a1977c3",
355-
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.1/xiond_19.0.1_linux_arm64.tar.gz?checksum=sha256:efed79d4b240c6edaa4488b54e7efcbff89313c0f0ed6e1682dab0f1d97315c2"
353+
"darwin/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_amd64.tar.gz?checksum=sha256:edda13aec2274f1eceb933874a885d055b14acbbe0de21ba61ed9c25c64813d6",
354+
"darwin/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_darwin_arm64.tar.gz?checksum=sha256:7b94d2fdf1baa1d3dff4f947858a2bac684257be27f8bf179fb973ee8dd4fdb8",
355+
"linux/amd64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_amd64.tar.gz?checksum=sha256:6072ce81d08f77f98e2d2ae7726007eca18579ea2b1690b5f76b4df782690dcb",
356+
"linux/arm64": "https://github.com/burnt-labs/xion/releases/download/v19.0.2/xiond_19.0.2_linux_arm64.tar.gz?checksum=sha256:0a55360653b596da5ace43c3b4a3fef6c9785bfe0e73405f591768b449af0e70"
356357
},
357358
"sdk": {
358359
"type": "cosmos",

0 commit comments

Comments
 (0)