Skip to content

Commit

Permalink
Add deployment workflow for MainNet (#1062)
Browse files Browse the repository at this point in the history
* Add deployment workflow for MainNet

- Added a MainNet deployment workflow that retrieves the latest release version and creates a software upgrade proposal.

* chore: update next version
  • Loading branch information
cosmic-vagabond authored Dec 16, 2024
1 parent 6676506 commit 1bf81d7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: Deploy in devnet
name: DevNet deploy
on:
workflow_dispatch:
# push:
# branches:
# - main

jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: deploy-devnet # Group for limiting concurrent runs
cancel-in-progress: false # Queue new jobs instead of canceling if one is already running
group: deploy-devnet # Group for limiting concurrent runs
cancel-in-progress: false # Queue new jobs instead of canceling if one is already running
environment: devnet
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
Expand Down Expand Up @@ -100,7 +97,7 @@ jobs:
echo "${{ secrets.PRIVATE_KEY_FUJI }}" > /tmp/private_key_fuji.txt
echo "${{ secrets.PRIVATE_KEY_MALLORCA }}" > /tmp/private_key_mallorca.txt
echo "${{ secrets.PRIVATE_KEY_BORA }}" > /tmp/private_key_bora.txt
# recover keys
echo "${{ secrets.PASSPHRASE_FUJI }}" | $ELYSD keys import fuji --keyring-backend test /tmp/private_key_fuji.txt
echo "${{ secrets.PASSPHRASE_MALLORCA }}" | $ELYSD keys import mallorca --keyring-backend test /tmp/private_key_mallorca.txt
Expand Down Expand Up @@ -135,4 +132,4 @@ jobs:
$ELYSD tx gov vote $proposalid yes --from=fuji $OPTIONS
$ELYSD tx gov vote $proposalid yes --from=mallorca $OPTIONS
$ELYSD tx gov vote $proposalid yes --from=bora $OPTIONS
sleep 10
sleep 10
56 changes: 56 additions & 0 deletions .github/workflows/mainnet-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: MainNet deploy

on:
workflow_dispatch:

permissions:
contents: write

jobs:
release:
name: Deploy to MainNet
runs-on: ubuntu-latest
steps:
- name: Create software upgrade proposal
run: |
# Get latest release version using GitHub API
ELYS_VERSION=$(curl -s https://api.github.com/repos/elys-network/elys/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
echo "Latest elys version: $ELYS_VERSION"
# Download latest binary
DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/${ELYS_VERSION}/elysd-${ELYS_VERSION}-linux-amd64
ELYSD=/tmp/elysd-${ELYS_VERSION}
curl -L $DOWNLOAD_URL -o $ELYSD && chmod +x $ELYSD
# helper functions
extract_txhash() { awk -F 'txhash: ' '/txhash:/{print $2; exit}'; }
extract_proposal_id() { awk -F 'key: proposal_id|value: ' '/key: proposal_id/ { getline; gsub(/"/, "", $2); print $2; exit }'; }
extract_and_calc_upgrade_height() { awk -F'"latest_block_height":"' '{ split($2,a,"\""); print a[1]+2100; exit }'; }
extract_checksum() { awk "/elysd-${ELYS_VERSION}-linux-amd64.tar.gz/ {print \$1; exit}"; }
# environment variables
NODE=https://rpc.elys.network:443
OPTIONS="--node $NODE --chain-id elys-1 --keyring-backend=test -b=sync --fees=100000uelys --gas=300000 -y"
# import proposer key
${ELYSD} keys import-hex proposer ${{ secrets.MAINNET_PROPOSER_PRIVATE_KEY }}
# get checksum
checksum=$(cat dist/sha256sum.txt | extract_checksum)
# query and upgrade height
height=$(${ELYSD} status --node $NODE | extract_and_calc_upgrade_height)
# create proposal
txhash=$(
${ELYSD} software-upgrade-tx \
${ELYS_VERSION} \
$height \
0uelys \
"Elys Network ${ELYS_VERSION} released. Focuses on enhancements and codebase improvements." \
"{\"binaries\":{\"linux/amd64\":\"https://github.com/elys-network/elys/releases/download/${ELYS_VERSION}/elysd-${ELYS_VERSION}-linux-amd64.tar.gz?checksum=$checksum\"}}" \
--from=proposer \
$OPTIONS | extract_txhash
)
sleep 10
proposalid=$(${ELYSD} q tx $txhash --node $NODE | extract_proposal_id)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create release
name: Create release and TestNet deploy

on:
push:
Expand All @@ -10,7 +10,7 @@ permissions:

jobs:
release:
name: Create release
name: Create release and TestNet deploy
runs-on: ubuntu-latest
steps:
- name: Check out repository code
Expand Down
2 changes: 1 addition & 1 deletion app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
)

// make sure to update these when you upgrade the version
var NextVersion = "v1.0.1"
var NextVersion = "v1.1.0"

func (app *ElysApp) setUpgradeHandler() {
app.UpgradeKeeper.SetUpgradeHandler(
Expand Down

0 comments on commit 1bf81d7

Please sign in to comment.