-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework renew configs workflow (#178)
- Loading branch information
1 parent
d5fc1d9
commit 9ffbb37
Showing
8 changed files
with
81 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.