-
Notifications
You must be signed in to change notification settings - Fork 18
156 lines (132 loc) · 5.17 KB
/
scheduled-release.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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: Check all generated configs
run: bash ./scripts/check-genesis.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