Skip to content

Commit

Permalink
rework renew configs workflow (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit authored Jul 19, 2024
1 parent d5fc1d9 commit 9ffbb37
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 162 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/renew-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Renew network configs

on:
workflow_dispatch:
inputs:
tag:
description: "tag version"
required: true
version:
description: "runtime version"
required: true

env:
BRANCH_PREFIX: update-config
CARGO_TERM_COLOR: always
TERM: xterm-256color

jobs:
update:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run script
run: ./scripts/renew-config.sh ${{ github.event.inputs.tag }} ${{ github.event.inputs.version }}

- name: New PR branch
id: new-branch
run: |
NAME="$BRANCH_PREFIX-${{ github.event.inputs.tag }}"
echo "::set-output name=name::$NAME"
- name: Create Pull Request if not exist
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: add new vara config
branch: ${{ steps.new-branch.outputs.name }}
delete-branch: true
base: master
title: "[Automated] Renew configs"
add-paths: |
config/*
body: |
"Automated renew configs for version ${{ github.event.inputs.tag }}"
draft: false
reviewers: osipov-mit
77 changes: 0 additions & 77 deletions .github/workflows/renew-testnet.yml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/renew-vara.yml

This file was deleted.

4 changes: 2 additions & 2 deletions config/rosetta/vara-mainnet.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/rosetta/vara-testnet.json

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions scripts/update-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TESTNET_CONFIG_PATH="./config/rosetta/vara-testnet.json"
MAINNET_CONFIG_PATH="./config/rosetta/vara-mainnet.json"

tag=$1
version=$2

testnet_meta_url="https://github.com/gear-tech/gear/releases/download/v"$tag"/testnet_vara_runtime_v"$version"_metadata.scale"
production_meta_url="https://github.com/gear-tech/gear/releases/download/v"$tag"/production_vara_runtime_v"$version"_metadata.scale"


echo "Downloading testnet metadata from $testnet_meta_url"
testnet_metadata=`curl -L $testnet_meta_url`

echo "Downloading production metadata from $production_meta_url"
production_metadata=`curl -L $production_meta_url`

echo "Updating testnet config"
jq --arg testnet_metadata "$testnet_metadata" --argjson version "$version" \
'.metadataRpc = $testnet_metadata | .specVersion = $version' \
"$TESTNET_CONFIG_PATH" > tmp.$$.json \
&& mv tmp.$$.json "$TESTNET_CONFIG_PATH"

echo "Updating mainnet config"
jq --arg production_metadata "$production_metadata" --argjson version "$version" \
'.metadataRpc = $production_metadata | .specVersion = $version' \
"$MAINNET_CONFIG_PATH" > tmp.$$.json \
&& mv tmp.$$.json "$MAINNET_CONFIG_PATH"
2 changes: 0 additions & 2 deletions spec-testnet.info

This file was deleted.

2 changes: 0 additions & 2 deletions spec-vara.info

This file was deleted.

0 comments on commit 9ffbb37

Please sign in to comment.