-
-
Notifications
You must be signed in to change notification settings - Fork 22
275 lines (217 loc) · 7.76 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Release
permissions:
contents: write
repository-projects: write
concurrency:
group: "release-${{ github.ref }}"
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
version:
description: 'release/tag: vX.Y.Z'
required: true
jobs:
create-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull
git checkout release 2>/dev/null || git checkout -b release
rm -rf ./src/bls && mkdir -p ./src/bls
git merge origin/master -q -m "chore(git): merged latest master"
git submodule update --init --recursive
git config user.name github-actions
git config user.email [email protected]
git push --set-upstream origin release
build-linux:
# For Linux build we use an Ubuntu version that's as old as possible so that
# the generated artifacts are compatible with not-so-recent systems
runs-on: ubuntu-20.04
needs: create-branch
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- uses: android-actions/setup-android@v2
- name: Install Android Platform
run: |
sdkmanager "platform-tools"
sdkmanager "platforms;android-29"
sdkmanager "build-tools;29.0.2"
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21d
- name: Build linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
git submodule update --init --recursive
sudo apt update
sudo apt install nasm
[ -d ./bls/lib/linux/ ] && rm -rf ./bls/lib/linux/
make clean
mkdir -p ./bls/lib/linux/
make CXX=clang++
make clean
# build linux/arm64
sudo apt-get install gcc-multilib
make aarch64
git config user.name github-actions
git config user.email [email protected]
git add ./bls/lib/linux -f
changes=$(git diff --staged --numstat | wc -l)
if [[ $changes -gt 0 ]]
then
git commit -m "fix(release): added libs for linux(amd64/arm64)"
git push
fi
- name: Build android
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
[ -d ./bls/lib/android/ ] && rm -rf ./bls/lib/android/
make clean
mkdir -p ./bls/lib/android/
make android
git config user.name github-actions
git config user.email [email protected]
git add ./bls/lib/android/ -f
changes=$(git diff --staged --numstat | wc -l)
if [[ $changes -gt 0 ]]
then
git commit -m "fix(release): added libs for android"
git push
fi
build-macos:
runs-on: macos-latest
needs: build-linux
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: Build darwin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
git submodule update --init --recursive
brew install nasm
[ -d ./bls/lib/darwin/ ] && rm -rf ./bls/lib/darwin/
make clean
mkdir -p ./bls/lib/darwin/
make ARCH=x86_64
make clean
make ARCH=arm64
git config user.name github-actions
git config user.email [email protected]
git add ./bls/lib/darwin/ -f
changes=$(git diff --staged --numstat | wc -l)
if [[ $changes -gt 0 ]]
then
git commit -m "fix(release): added libs for darwin"
git push
fi
- name: Build ios
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
git submodule update --init --recursive
[ -d ./bls/lib/ios ] && rm -rf ./bls/lib/ios
[ -d ./bls/lib/iossimulator ] && rm -rf ./bls/lib/iossimulator
make clean
mkdir -p ./bls/lib/ios
mkdir -p ./bls/lib/iossimulator
git config user.name github-actions
git config user.email [email protected]
make ios
make ios_simulator
git add ./bls/lib/ios -f
git add ./bls/lib/iossimulator -f
changes=$(git diff --staged --numstat | wc -l)
if [[ $changes -gt 0 ]]
then
git commit -m "fix(release): added libs for ios/ios simulator"
git push
fi
build-windows:
runs-on: windows-latest
needs: build-macos
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW64
install: base-devel git gcc make python3 nasm # mingw-w64-x86_64-clang
- name: Build windows
# shell: msys2 {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
git submodule update --init --recursive
gcc --version
python3 --version
git checkout .
if (Test-Path "./bls/lib/windows/amd64") {
Remove-Item "./bls/lib/windows/amd64" -Recurse -Force
}
make clean
# make -j # ar gives an error for some reason, so use the followings:
md "./bls/lib/windows/amd64"
make -C ./src/bls -f Makefile.onelib LIB_DIR=./
cp ./src/bls/libbls384_256.a ./bls/lib/windows/amd64/libbls384_256.a
git config user.name github-actions
git config user.email [email protected]
git add ./bls/lib/windows -f && git commit -m "fix(release): added libs for windows" && git push
create-release:
runs-on: ubuntu-latest
needs: build-windows
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set hash
id: set-hash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
git pull && git checkout release
git submodule update --init --recursive
git branch -av
git rev-parse HEAD
echo "hash=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: show
run: |
echo "hash" "${{ env.hash }}"
- name: Create Release
id: create_release
run: gh release create "${{ github.event.inputs.version }}" -t "${{ github.event.inputs.version }}" --target "release" --latest
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"