Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework renew configs workflow #178

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading