Skip to content

Renew QR Vara

Renew QR Vara #8956

Workflow file for this run

name: Renew QR Vara
on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'
env:
BRANCH_PREFIX: updated-qr
CARGO_TERM_COLOR: always
TERM: xterm-256color
jobs:
update:
runs-on: ubuntu-latest
env:
RUSTUP_HOME: /tmp/rustup_home
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Install: Set cargo path"
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH
- name: Collation Genesis and SpecVersion
id: compare
run: |
# Check Genesis and SpecVersion
RenewedGenesis=$(curl -X POST https://rpc.vara-network.io/jsonrpc -H 'Content-Type: application/json' -d '[ { "id": 1, "jsonrpc": "2.0", "method": "chain_getBlockHash", "params": [0]}]' | jq -r '.[].result');
RenewedSpecVersion=$(curl -X POST https://rpc.vara-network.io/jsonrpc -H 'Content-Type: application/json' -d '[ { "id": 1, "jsonrpc": "2.0", "method": "state_getRuntimeVersion", "params": []}]' | jq -r '.[].result.specVersion');
# Read previous Genesis and SpecVersion from file
originalgenesis=$(sed '1!d' spec.info)
originalspecVersion=$(sed '2!d' spec.info)
NewValue="$RenewedGenesis\n$RenewedSpecVersion"
# Compare
if [ "$originalspecVersion" -ne "$RenewedSpecVersion" ] || [ "$originalgenesis" != "$RenewedGenesis" ]
then echo "Sper or Genesis change" && echo -e "$NewValue" > spec.info && echo "::set-output name=metaChanged::true"
else echo "Spec and Genesis haven't changed"
fi
- name: "Install: Nightly toolchain"
if: ${{ steps.compare.outputs.metaChanged == 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
components: llvm-tools-preview
- name: "Install: Build deps"
if: ${{ steps.compare.outputs.metaChanged == 'true' }}
run: |
sudo apt update
sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler wget bzip2 pkg-config libopencv-dev libclang-dev
sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz -O - | sudo tar -xz -C .
sudo cp binaryen-version_111/bin/wasm-opt /usr/bin/
sudo wget -c https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz -O - | sudo tar -xz -C .
sudo cp sccache-v0.3.3-x86_64-unknown-linux-musl/sccache /usr/bin/
sudo chmod +x /usr/bin/sccache
- name: ⚙ Update QRs from RPC nodes
id: update-nodes
if: ${{ steps.compare.outputs.metaChanged == 'true' }}
run: |
cargo run --release update --sign --signing-key ${{secrets.SIGNING_KEY}}
- name: New PR branch
if: ${{ steps.compare.outputs.metaChanged == 'true' }}
id: new-branch
run: |
NAME="$BRANCH_PREFIX-$(date '+%Y-%m-%d')"
echo "::set-output name=name::$NAME"
- name: "Delete files"
run: sudo rm -rf binaryen-version_111/
- name: Create Pull Request if not exist
if: ${{ steps.compare.outputs.metaChanged == 'true' }}
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: add updated QR codes
branch: ${{ steps.new-branch.outputs.name }}
delete-branch: true
base: master
title: '[Automated] Review new metadata QRs'
add-paths: |
spec.info
public/qr/*
body: |
Updated metadata QR codes
draft: false