Repository navigation
126 lines (111 loc) · 3.9 KB
/
Copy pathsync-default-configs.yml
File metadata and controls
126 lines (111 loc) · 3.9 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Sync default seid configs
# Rebuilds the latest tagged seid release, runs `seid init`, and pipes the
# resulting app.toml / config.toml / client.toml into the inlined "Default
# Configurations" section of node/node-operators.mdx. If anything changed,
# commits the result straight to main.
#
# Triggers:
# - workflow_dispatch (manual; can override the seid version)
# - schedule (weekly, Mondays 06:00 UTC)
on:
workflow_dispatch:
inputs:
sei_version:
description: 'seid release tag to build (default: latest GitHub release)'
required: false
type: string
default: ''
schedule:
- cron: '0 6 * * 1'
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout docs
uses: actions/checkout@v4
- name: Resolve seid version
id: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_VERSION: ${{ inputs.sei_version }}
run: |
set -euo pipefail
requested="${INPUT_VERSION:-}"
if [[ -n "$requested" ]]; then
tag="$requested"
echo "Using requested seid tag: $tag"
else
tag=$(gh api repos/sei-protocol/sei-chain/releases/latest --jq .tag_name)
echo "Resolved latest seid tag: $tag"
fi
if [[ -z "$tag" ]]; then
echo "::error::Could not resolve a seid release tag"
exit 1
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Checkout sei-chain
uses: actions/checkout@v4
with:
repository: sei-protocol/sei-chain
ref: ${{ steps.version.outputs.tag }}
path: sei-chain
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: sei-chain/go.mod
cache-dependency-path: sei-chain/go.sum
- name: Install build helpers
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends tree
- name: Build seid
working-directory: sei-chain
run: |
set -euo pipefail
export PATH="$(go env GOPATH)/bin:$PATH"
make install
seid version --long || seid version
- name: Capture commit SHA
id: commit
working-directory: sei-chain
run: echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Run seid init
env:
SEI_VERSION: ${{ steps.version.outputs.tag }}
run: |
set -euo pipefail
export PATH="$(go env GOPATH)/bin:$PATH"
rm -rf "$HOME/.sei"
seid init docs-example --chain-id pacific-1
echo "---"
ls -la "$HOME/.sei/config"
- name: Regenerate inlined default configs
env:
SEI_VERSION: ${{ steps.version.outputs.tag }}
SEI_COMMIT: ${{ steps.commit.outputs.sha }}
run: |
export SEI_HOME="$HOME/.sei"
node scripts/sync-default-configs.mjs
- name: Show diff (for log visibility)
run: git --no-pager diff --stat -- node/node-operators.mdx || true
- name: Commit and push to main if changed
env:
SEI_VERSION: ${{ steps.version.outputs.tag }}
run: |
set -euo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
if git diff --quiet -- node/node-operators.mdx; then
echo 'No changes to node/node-operators.mdx; nothing to commit.'
exit 0
fi
git add node/node-operators.mdx
git commit -m "docs(node): sync default configs from seid ${SEI_VERSION}"
# Rebase onto any concurrent pushes before writing back to main.
git pull --rebase --autostash origin main
git push origin HEAD:main