Skip to content

Scheduled Release #11440

Scheduled Release

Scheduled Release #11440

name: Scheduled Release
on:
schedule:
- cron: "10,40 * * * *"
workflow_dispatch:
jobs:
check_genesis:
name: Check genesis time for next release
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
outputs:
can_release: ${{ steps.can_release.outputs.can_release }}
steps:
- uses: actions/checkout@v3
- name: Check genesis time
run: |
echo "can_release=$(bash ./scripts/check_can_release.sh | tr -d '\n')" >> $GITHUB_OUTPUT
id: can_release
- name: Cancel workflow if nothing to do
if: steps.can_release.outputs.can_release != 'true'
run: |
gh api repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/cancel -X POST
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_release:
name: Build Release Config
needs: [check_genesis]
if: needs.check_genesis.outputs.can_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Build testnet configs
run: bash ./scripts/build-genesis.sh
- name: Build bootnode enr
run: bash ./scripts/build-boot-enr.sh
- name: Build nodevars.env
run: bash ./scripts/build-nodevars.sh
- name: Get ITERATION_NUMBER as version
run: |
echo "iteration=$(cat values.env | grep 'ITERATION_NUMBER' | sed 's/.*ITERATION_NUMBER=\"\([0-9]*\)\"/\1/g' | tr -d '\n')" >> $GITHUB_OUTPUT
echo "release=$(cat ./dist/retention.vars | grep 'ITERATION_RELEASE' | sed 's/.*ITERATION_RELEASE=\"\(.*\)\"/\1/g' | tr -d '\n')" >> $GITHUB_OUTPUT
genesis_time=$(cat values.env | grep 'GENESIS_TIMESTAMP' | sed 's/.*GENESIS_TIMESTAMP=\"\([0-9]*\)\"/\1/g' | tr -d '\n')
echo "genesis_time=$genesis_time" >> $GITHUB_OUTPUT
echo "genesis_date=$(date -d @$genesis_time)" >> $GITHUB_OUTPUT
echo "chainid=$(cat values.env | grep 'CHAIN_ID' | sed 's/.*CHAIN_ID=\"\([0-9]*\)\"/\1/g' | tr -d '\n')" >> $GITHUB_OUTPUT
echo "reset_time=$(cat values.env | grep 'GENESIS_INTERVAL' | sed 's/.*GENESIS_INTERVAL=\"\([0-9]*\)\"/\1/g' | tr -d '\n')" >> $GITHUB_OUTPUT
id: version
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: "${{ steps.version.outputs.release }}"
tag_name: "${{ steps.version.outputs.release }}"
body: |
ChainId: ${{ steps.version.outputs.chainid }}
Genesis Time: ${{ steps.version.outputs.genesis_time }} (${{ steps.version.outputs.genesis_date }})
Reset Interval: ${{ steps.version.outputs.reset_time }}
| Release File | Description |
| ------------- | ------------- |
| genesis.json | Execution Layer Genesis |
| config.yaml | Consensus Layer Config |
| genesis.ssz | Consensus Layer Genesis |
| testnet-all.tar.gz | Full testnet configuration (`testnet` directory) |
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Pack testnet configs
run: cd dist && tar cfz testnet-all.tar.gz *
- name: Upload full config artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/testnet-all.tar.gz
asset_name: testnet-all.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload genesis.json artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/genesis.json
asset_name: genesis.json
asset_content_type: application/json
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload config.yaml artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/config.yaml
asset_name: config.yaml
asset_content_type: application/yaml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload genesis.ssz artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/genesis.ssz
asset_name: genesis.ssz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
prepare_rollback:
name: Prepare master branch for next rollback
needs: build_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update values.env for next round
run: bash ./scripts/prepare-rollback.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Prepare values.env for next rollback
branch: master
push_options: '--force'
skip_checkout: true