Sync default seid configs #6
This file contains hidden or 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
| 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 |