-
Notifications
You must be signed in to change notification settings - Fork 17
279 lines (228 loc) · 10.8 KB
/
bet-cd.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
276
277
278
name: bet CD
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
# Build Linux x86 64bit build
linux-build-x86_64:
runs-on: ubuntu-18.04
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: show extracted branch name
run: echo ${{ steps.extract_branch.outputs.branch }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- run: git fetch --prune --unshallow
- name: apt update
run: sudo apt-get update
- name: Installing dependencies
run: |
sudo apt-get install autoconf automake build-essential sudo libtool libgmp-dev \
libsqlite3-dev python3 python3-mako net-tools zlib1g-dev libsodium-dev \
gettext wget libcurl3-gnutls ninja-build libssl-dev \
libcurl4-gnutls-dev libevent-dev
- name: configure
run: ./configure --enable-static
- name: make
run: make
- name: Extract git tag
shell: bash
run: echo "##[set-output name=gittag;]$(IFS='-' read -r -a array <<< $(git describe --always) && echo "${array[0]}-${array[1]}")"
id: extract_git_tag
- name: List files
run: |
pwd && \
tar -czvf bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz privatebet/bet privatebet/cashierd privatebet/config && \
ls -lh bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
- name: Upload bet-linux-x86_64 release files
uses: actions/upload-artifact@v2
with:
name: bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
path: /home/runner/work/bet/bet/bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
# Build Linux ARM 64bit build
linux-build-arm64:
runs-on: [self-hosted, linux, ARM64, Raspberry-Pi]
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: show extracted branch name
run: echo ${{ steps.extract_branch.outputs.branch }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- run: git fetch --prune --unshallow
- name: configure
run: ./configure --enable-static
- name: make
run: make
- name: Extract git tag
shell: bash
run: echo "##[set-output name=gittag;]$(IFS='-' read -r -a array <<< $(git describe --always) && echo "${array[0]}-${array[1]}")"
id: extract_git_tag
- name: List files
run: |
pwd && \
tar -czvf bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz privatebet/bet privatebet/cashierd privatebet/config && \
ls -lh bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
- name: Cleanup after build
run: sed -i 's/clean=.*/clean=1/' /home/pi/trigger
- name: Upload bet-linux release files
uses: actions/upload-artifact@v2
with:
name: bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
path: /home/pi/actions-runner/_work/bet/bet/bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
# Build MacOS 64bit build
macos-build-x86_64:
runs-on: macos-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: show extracted branch name
run: echo ${{ steps.extract_branch.outputs.branch }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- run: git fetch --prune --unshallow
- name: Install deps (macOS)
run: |
brew update
brew install zlib
brew install autoconf
brew install automake
brew install libtool
brew install gmp
brew install sqlite
brew install libsodium
brew install gettext
brew install wget
brew install curl
brew install ninja
brew install openssl
brew install libevent
brew install cmake
brew install python3
brew install gnu-sed
brew install pyenv
pip3 install mako
- name: configure
run: ./configure
- name: make
run: |
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
make
- name: Extract git tag
shell: bash
run: echo "##[set-output name=gittag;]$(array=($(echo $(git describe --always) | tr '-' "\n")) && echo "${array[0]}-${array[1]}")"
id: extract_git_tag
- name: List files
run: |
pwd && \
tar -czvf bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz privatebet/bet privatebet/cashierd privatebet/config && \
ls -lh bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
- name: Upload bet-macos-x86_64 release files
uses: actions/upload-artifact@v2
with:
name: bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
path: /Users/runner/work/bet/bet/bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
publish-release:
name: Publishing CD releases
runs-on: ubuntu-latest
needs: [linux-build-x86_64, macos-build-x86_64, linux-build-arm64]
# needs: [linux-build-x86_64, linux-build-arm64]
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: show extracted branch name
run: echo ${{ steps.extract_branch.outputs.branch }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- run: git fetch --prune --unshallow
- name: Extract git tag
shell: bash
run: echo "##[set-output name=gittag;]$(IFS='-' read -r -a array <<< $(git describe --always) && echo "${array[0]}-${array[1]}")"
id: extract_git_tag
- uses: actions/download-artifact@v2
with:
path: artifacts
- name: Display structure of downloaded files
run: |
pwd && \
ls -lhRa
working-directory: artifacts
- name: Shortify commit sha
shell: bash
run: echo "##[set-output name=sha_short;]$(echo ${GITHUB_SHA::7})"
id: shortify_commit
- name: List Downloaded files
run: |
pwd && \
ls -lh /home/runner/work/bet/bet/artifacts/bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz && \
ls -lh /home/runner/work/bet/bet/artifacts/bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz && \
ls -lh /home/runner/work/bet/bet/artifacts/bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_git_tag.outputs.gittag }}
release_name: ${{ steps.extract_git_tag.outputs.gittag }}
body: |
CD Release:
- From Branch: ${{ steps.extract_branch.outputs.branch }}
- SHA: ${{ steps.shortify_commit.outputs.sha_short }}
- Version tag: ${{ steps.extract_git_tag.outputs.gittag }}
draft: false
prerelease: false
- name: Upload Linux Release Asset
id: upload-linux-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: /home/runner/work/bet/bet/artifacts/bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_name: bet-linux-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_content_type: application/gzip
- name: Upload Linux ARM64 Release Asset
id: upload-linux-arm64-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: /home/runner/work/bet/bet/artifacts/bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_name: bet-linux-aarch64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_content_type: application/gzip
- name: Upload MacOS Release Asset
id: upload-macos-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: /home/runner/work/bet/bet/artifacts/bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz/bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_name: bet-macos-x86_64-${{ steps.extract_git_tag.outputs.gittag }}.tar.gz
asset_content_type: application/gzip