Skip to content

Commit efe5f82

Browse files
authored
Auto-deploy release contracts to Neutron (#203)
1 parent 915f214 commit efe5f82

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,66 @@ jobs:
1313
steps:
1414
- name: Checkout sources
1515
uses: actions/checkout@v4
16+
17+
- name: Install jq
18+
run: sudo apt-get install jq
19+
1620
- name: Install cargo-run-script
1721
uses: actions-rs/cargo@v1
1822
with:
1923
command: install
2024
args: cargo-run-script
25+
2126
- name: Run cargo optimize
2227
uses: actions-rs/cargo@v1
2328
with:
2429
command: run-script
2530
args: optimize
31+
32+
- name: Export checksums to json
33+
run: |
34+
jq -cR 'split(" ") | {"code_hash":.[0], "contract":.[1]}' ./artifacts/checksums.txt | jq -cs '.' > checksums.json
35+
2636
- name: Get release ID
2737
id: get_release
2838
uses: bruceadams/[email protected]
2939
env:
3040
GITHUB_TOKEN: ${{ github.token }}
41+
3142
- name: Upload optimized wasm
3243
uses: svenstaro/[email protected]
33-
3444
with:
3545
repo_token: ${{ secrets.GITHUB_TOKEN }}
3646
file: ./artifacts/*
3747
tag: ${{ github.ref }}
3848
overwrite: true
3949
file_glob: true
50+
51+
- name: Get Timewave's CI Neutron deployment key (as in, private key)
52+
run: echo "${{ secrets.TW_CI_NEUTRON_KEY }}" > tw_ci_neutron.key
53+
54+
- name: Install Neutron & import key
55+
run: |
56+
wget -O neutrond https://github.com/neutron-org/neutron/releases/download/v3.0.2/neutrond-linux-amd64
57+
chmod +x neutrond
58+
echo ${{ secrets.TW_CI_NEUTRON_KEY_PASS }} | neutrond keys import tw_ci_neutron tw_ci_neutron.key
59+
60+
- name: Deploy WASM contracts to Neutron
61+
run: |
62+
find ./artifacts -name \*.wasm -exec neutrond tx wasm store {} --from tw_ci_neutron --gas auto --gas-prices 0.01untrn --gas-adjustment 1.3 --output json -y \; -exec sleep 5 \;
63+
64+
- name: Get contract code IDs
65+
run: |
66+
./neutrond query wasm list-code --reverse --output json | jq -c '.code_infos[] | select(.creator == "${{ tw_ci_neutron }}") | {code_id: .code_id, code_hash: .data_hash|ascii_downcase}' | jq -s . > code_ids.json
67+
68+
- name: Join code IDs & checksums
69+
run: |
70+
jq '[JOIN(INDEX(input[]; .code_hash); .[]; .code_hash; add)]' checksums.json code_ids.json | jq '.[] | [.contract, .code_id] | @tsv' contract_code_ids.txt
71+
72+
- name: Append code IDs to release notes
73+
uses: softprops/action-gh-release@v2
74+
if: startsWith(github.ref, 'refs/tags/')
75+
with:
76+
body_path: contract_code_ids.txt
77+
append_body: true
78+
files: contract_code_ids.txt

0 commit comments

Comments
 (0)