-
Notifications
You must be signed in to change notification settings - Fork 30
218 lines (189 loc) · 5.83 KB
/
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
name: Release
on:
push:
tags:
- v*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
name: Build Release
strategy:
matrix:
go-version: [1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# ==============================
# Linux/Macos Build
# ==============================
- name: Build Binary for ${{matrix.os}}
env:
CGO_ENABLED: "0"
run: |
go mod download
make geth
# ==============================
# Cross Compile for ARM
# ==============================
- name: Build Binary for ARM
if: matrix.os == 'ubuntu-latest'
run: |
go mod download
make geth-linux-arm
# ==============================
# Upload artifacts
# ==============================
- name: Upload Linux Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: linux
path: ./build/bin/geth
- name: Upload MacOS Build
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: macos
path: ./build/bin/geth
- name: Upload Windows Build
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: windows
path: ./build/bin/geth.exe
- name: Upload ARM-5 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm5
path: ./build/bin/geth-linux-arm-5
- name: Upload ARM-6 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm6
path: ./build/bin/geth-linux-arm-6
- name: Upload ARM-7 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm7
path: ./build/bin/geth-linux-arm-7
- name: Upload ARM-64 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm64
path: ./build/bin/geth-linux-arm64
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Set Env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v3
# ==============================
# Download artifacts
# ==============================
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: linux
path: ./linux
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: macos
path: ./macos
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: windows
path: ./windows
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm5
path: ./arm5
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm6
path: ./arm6
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm7
path: ./arm7
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm64
path: ./arm64
- name: Download Config File
run: |
. ./.github/release.env
echo "mainnet.zip url: $MAINNET_FILE_URL"
echo "testnet.zip url: $TESTNET_FILE_URL"
curl -L $MAINNET_FILE_URL -o ./mainnet.zip
curl -L $TESTNET_FILE_URL -o ./testnet.zip
# ==============================
# Create release
# ==============================
- name: Generate Change Log
id: changelog
run: |
chmod 755 ./.github/generate_change_log.sh
CHANGELOG=$(./.github/generate_change_log.sh ${{ env.RELEASE_VERSION}})
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Rename assets
- run: |
mv ./linux/geth ./linux/geth_linux
mv ./macos/geth ./macos/geth_macos
mv ./windows/geth.exe ./windows/geth_windows.exe
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.RELEASE_VERSION}}
release_name: ${{ env.RELEASE_VERSION}}
body: |
${{ env.CHANGELOG }}
draft: false
prerelease: false
files: |
./mainnet.zip
./testnet.zip
./linux/geth_linux
./macos/geth_macos
./windows/geth_windows.exe
./arm5/geth-linux-arm-5
./arm6/geth-linux-arm-6
./arm7/geth-linux-arm-7
./arm64/geth-linux-arm64