forked from paritytech/metadata-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (81 loc) · 3.08 KB
/
auto-sign.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Auto Sign and Merge Update
concurrency:
group: ${{github.workflow}}
cancel-in-progress: true
on:
workflow_dispatch: # via manual trigger
schedule:
- cron: "47 * * * *" # every hour on the 47th minute to avoid high load 0 times
env:
BRANCH_PREFIX: auto-signed
RUST_LOG: debug
jobs:
auto-sign:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🔧 Install Rust dependencies
uses: ./.github/workflows/rust-install
- name: Check out PR branch if it already exists
id: checkout-pr-branch
run: |
AUTO_SIGNED_BRANCH=$(git branch -r --list "origin/$BRANCH_PREFIX-*" --sort=-refname | head -n 1)
if [ -z "$AUTO_SIGNED_BRANCH" ]
then
hasbranch='false'
else
git checkout --track $AUTO_SIGNED_BRANCH
hasbranch='true'
fi
echo "hasbranch=$hasbranch" >> $GITHUB_OUTPUT
- name: ⚙ Clean metadata-cli
run: cargo clean --release
- name: ⚙ Autosign QRs from RPC nodes
env:
SIGNING_SEED_PHRASE: ${{secrets.SIGNING_SEED_PHRASE}}
run: cargo run --release -- auto-sign --source node
# Skip Github releases for now as the UI doesn't support future metadata anymore
# - name: ⚙ Autosign QRs from GitHub releases
# env:
# SIGNING_SEED_PHRASE: ${{secrets.SIGNING_SEED_PHRASE}}
# run: cargo run --release -- auto-sign --source github
- name: ⚙ Run Collector
run: cargo run --release -- collect
- name: ⚙ Run Cleaner
run: cargo run --release -- clean
- name: 📌 Commit changes if PR branch exists
if: ${{ steps.checkout-pr-branch.outputs.hasbranch == 'true' }}
uses: ./.github/workflows/commit-changes
with:
message: "metadata update"
- name: Create name for new PR branch if it doesn't already exist
if: ${{ steps.checkout-pr-branch.outputs.hasbranch == 'false' }}
id: new-branch
run: |
branchname="$BRANCH_PREFIX-$(date '+%Y-%m-%d')"
echo "branchname=$branchname" >> $GITHUB_OUTPUT
- name: Create PR branch if it doesn't already exist
if: ${{ steps.checkout-pr-branch.outputs.hasbranch == 'false' }}
id: cpr
uses: peter-evans/create-pull-request@c55203cfde3e5c11a452d352b4393e68b85b4533
with:
commit-message: add signed QR image files
branch: ${{ steps.new-branch.outputs.branchname }}
delete-branch: true
base: main
title: "[Automated] Updated signed metadata QR image files"
body: |
If the Metadata Portal needs updated data, inspect the data.json file to determine whether it is correct and then merge this PR.
draft: false
reviewers: |
wilwade
shannonwells
enddynayn
aramikm