-
Notifications
You must be signed in to change notification settings - Fork 108
233 lines (204 loc) · 7.64 KB
/
publish-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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
name: Publish Release
on:
push:
tags:
- "v*.*.*"
concurrency:
group: publish-release
cancel-in-progress: false
env:
GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')"
jobs:
pre-release-checks:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Major Version in Upgrade Handler Must Match Tag
run: |
UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f1)
echo $UPGRADE_HANDLER_MAJOR_VERSION
GITHUB_TAG_MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f1)
if [ $GITHUB_TAG_MAJOR_VERSION != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
echo "ERROR: The major version of this release (${{ github.ref_name }}) does not match the major version in the releaseVersion constant ($UPGRADE_HANDLER_MAJOR_VERSION) found in app/setup_handlers.go"
echo "Did you forget to update the 'releaseVersion' in app/setup_handlers.go?"
exit 1
fi
echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
publish-release:
runs-on: buildjet-4vcpu-ubuntu-2004
timeout-minutes: 60
needs:
- pre-release-checks
steps:
- uses: actions/checkout@v3
- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "true"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
generate_release_notes: true
- name: Publish Release Files
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
run: |
touch .release-env
make release
## TODO - Will add in later after optimizing docker images
# - name: Build, tag, and push docker images
# uses: ./.github/actions/build-docker-images
# with:
# DOCKER_FILENAME: Dockerfile
# REPOSITORY_NAME: zeta-node
# IMAGE_TAG: ${{ env.TAG_NAME }}
# GHCR_USERNAME: ${{ secrets.PAT_GITHUB_SERVICE_ACCT_USERNAME }}
# GHCR_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
build-alpine:
runs-on: ["ubuntu-latest"]
timeout-minutes: 30
concurrency:
group: "alpine-build-test"
needs:
- pre-release-checks
steps:
- uses: actions/checkout@v3
- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "false"
- uses: jirutka/setup-alpine@v1
with:
branch: v3.17
arch: x86_64
packages: >
build-base
pkgconf
lld
go
gcc
g++
libusb-dev
linux-headers
git
shell-name: alpine.sh
- name: Build zetacored and zetaclientd
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
git config --global --add safe.directory '*'
make install-testnet
cp "$HOME"/go/bin/* ./
- name: Binary Docker Test
env:
CPU_ARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
chmod a+x ./zetacored
./zetacored version
mv zetacored zetacored-testnet-alpine-$CPU_ARCH
mv zetaclientd zetaclientd-testnet-alpine-$CPU_ARCH
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
generate_release_notes: true
files: |
zetacored-*
zetaclientd-*
- name: Clean Up Alpine Workspace
if: always()
shell: alpine.sh --root {0}
run: |
set -e # fail on error
rm -rf *
- name: Clean Up Workspace
if: always()
shell: bash
run: rm -rf *
announce-release:
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- publish-release
- build-alpine
steps:
- uses: actions/checkout@v3
- name: Get Version
run: |
VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
echo "BINARY_VERSION=${VERSION}" >> ${GITHUB_ENV}
- name: Determine Release Type
id: determine_release_type
run: |
if [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.0\.0+$ ]]; then
echo "RELEASE_TYPE=major" >> ${GITHUB_ENV}
elif [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.[0-9]+\.[1-9]+$ ]]; then
echo "RELEASE_TYPE=minor" >> ${GITHUB_ENV}
else
echo "RELEASE_TYPE=unknown" >> ${GITHUB_ENV}
fi
- name: "SEND:DISCORD:MESSAGE"
if: steps.determine_release_type.outputs.RELEASE_TYPE == 'major'
uses: gzukel/CosmosComposites/send_discord_message@main
with:
discord_token: "${{ secrets.DISCORD_TOKEN }}"
discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
discord_message: |
Hey <@&1122981184255840306>! A new version of the ZetaChain software has been released.
Major Version Upgrade (e.g. v5.x.x to V6.x.x) must be completed through a governance proposal.
We will submit a governance proposal in the next few days.
More specific information including block height will be shared as part of the governance proposal.
See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
# - name: "SEND:DISCORD:MESSAGE"
# if: steps.determine_release_type.outputs.RELEASE_TYPE == 'minor'
# uses: gzukel/CosmosComposites/send_discord_message@main
# with:
# discord_token: "${{ secrets.DISCORD_TOKEN }}"
# discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
# discord_message: |
# Hey <@&1122981184255840306>! A new version of the zetachain node has been released.
# Minor Version Upgrade (e.g. v5.0.x to v5.1.x) can be applied without a governance proposal.
# Please review the release notes for any specific upgrade instructions or considerations.
# See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
- name: Clean Up Workspace
if: always()
shell: bash
run: rm -rf *