Skip to content

Commit f9de65f

Browse files
authored
Add Move deploy actions (#1641)
1 parent 5aebb31 commit f9de65f

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'load-keytool'
2+
description: 'Load Keytool'
3+
inputs:
4+
network:
5+
description: 'Network to configure'
6+
required: true
7+
pk:
8+
description: 'Private key to load into Keytool'
9+
required: true
10+
bak-pk:
11+
description: 'Backup Private key to load into Keytool'
12+
required: true
13+
faucet:
14+
description: "Whether to faucet"
15+
required: true
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Load PK into Keytool
21+
shell: bash
22+
run: |
23+
iota keytool import $(iota keytool convert ${inputs.pk} --json | jq -r '.bech32WithFlag') ed25519 --alias deploy-key
24+
iota client switch --env ${inputs.network}
25+
iota client switch --address deploy-key
26+
27+
# test backup key
28+
iota keytool import $(iota keytool convert ${inputs.bak-pk} --json | jq -r '.bech32WithFlag') ed25519 --alias backup-key
29+
iota keytool list --json | jq -r '.[] | select(.alias=="deploy-key")'
30+
iota keytool list --json | jq -r '.[] | select(.alias=="backup-key")'
31+
32+
if [ ${inputs.faucet} == "true" ]; then
33+
iota client faucet
34+
# wait up tp 5min for Gas to be available
35+
timeout 5m bash -c "until (( $(iota client gas --json | jq -r '.[].nanosBalance') > 0)); do sleep 10; done"
36+
fi
37+

.github/actions/iota-rebase-sandbox/setup/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: "IOTA version to pull from GitHub releases, recognizes well known networks (mainnet, testnet, devnet), defaults to 'testnet'"
1515
required: false
1616
default: ""
17+
start-sandbox:
18+
description: "Wether to start the sandbox or just install"
19+
required: false
20+
default: "true"
1721

1822
runs:
1923
using: composite
@@ -84,6 +88,7 @@ runs:
8488
- name: Start the Network
8589
shell: bash
8690
working-directory: iota
91+
if: ${{ inputs.start-sandbox == 'true' }}
8792
run: |
8893
# Clear previous configuration
8994
rm -rf ~/.iota || true
+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Deploy Move package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Name of branch to checkout'
8+
required: true
9+
network:
10+
description: 'Network to deploy to'
11+
required: true
12+
faucet:
13+
description: 'Whether to faucet'
14+
required: true
15+
script-path:
16+
description: 'Script to tun'
17+
required: true
18+
dry-run:
19+
description: 'Run in dry-run mode'
20+
type: boolean
21+
required: false
22+
default: true
23+
24+
jobs:
25+
deploy-move-package:
26+
environment: release
27+
name: Deploy Move package and create PR to bump references.
28+
runs-on: ubuntu-latest
29+
steps:
30+
31+
- name: Check out the repo
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ github.event.inputs.branch }}
35+
36+
- name: Start iota sandbox
37+
uses: './.github/actions/iota-rebase-sandbox/setup'
38+
with:
39+
platform: 'linux'
40+
iota-version: ${{ github.event.inputs.network }}
41+
start-sandbox: false
42+
43+
- name: Setup Keytool
44+
uses: './.github/actions/iota-rebase-sandbox/load-keytool'
45+
with:
46+
network: ${{ github.event.inputs.network }}
47+
pk: ${{secrets.TRUST_FRAMEWORK_PRODUCTS_PRIVATE_KEY}}
48+
bak_pk: ${{secrets.TRUST_FRAMEWORK_PRODUCTS_PRIVATE_KEY_BACKUP}} #only for testing, TODO: remove
49+
faucet: ${{ github.event.inputs.faucet }}
50+
51+
- name: Import GPG key
52+
id: import-gpg
53+
uses: crazy-max/ghaction-import-gpg@cb4264d3319acaa2bea23d51ef67f80b4f775013
54+
with:
55+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
56+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
57+
git_user_signingkey: true
58+
git_commit_gpgsign: true
59+
git_tag_gpgsign: true
60+
61+
- name: Run script
62+
if: ${{ github.event.inputs.dry-run == 'false' }}
63+
run: |
64+
source ${{ github.event.inputs.script-path}}
65+
66+
- name: Commit changes
67+
if: ${{ github.event.inputs.dry-run == 'false' }}
68+
run: |
69+
git add .
70+
if [[ $(git diff --stat --staged) == '' ]]; then
71+
echo 'repository unmodified'
72+
exit 1
73+
fi
74+
git commit -m "bump version"
75+
76+
- name: Create Pull Request
77+
uses: peter-evans/create-pull-request@67df31e08a133c6a77008b89689677067fef169e
78+
if: ${{ github.event.inputs.dry-run == 'false' }}
79+
with:
80+
committer: GitHub <noreply@github.com>
81+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
82+
branch: chore/deploy-${{ github.event.inputs.network }}
83+
delete-branch: true
84+
title: 'Deploy ${{ github.event.inputs.network }}'
85+
body: |
86+
This PR contains changes running ${{ github.event.inputs.script-path }} on branch:${{ github.event.inputs.branch }} and network:${{ github.event.inputs.network }}
87+
labels: |
88+
No changelog

0 commit comments

Comments
 (0)