-
Notifications
You must be signed in to change notification settings - Fork 36
271 lines (258 loc) · 8.59 KB
/
build.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
name: Termtunnel
env:
BUILD_TYPE: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
default: '1.0'
push:
tags:
- '*'
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')"
- name: Test with environment variables
run: echo $TAG_NAME - $RELEASE_NAME
env:
TAG_NAME: nightly-tag-${{ steps.date.outputs.date }}
RELEASE_NAME: nightly-release-${{ steps.date.outputs.date }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: version-${{ github.event.inputs.version }}
release_name: Termtunnel version ${{ github.event.inputs.version }}
body: |
${{ github.event.head_commit.message }}
#draft: false
#prerelease: true
- id: step_upload_url
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"
create_linux_amd64_static_release:
needs: create_release
name: Create static linux amd64 release
runs-on: ubuntu-latest
env:
CC: /opt/x86_64-linux-musl-native/bin/x86_64-linux-musl-gcc
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: |
curl -O http://musl.cc/x86_64-linux-musl-native.tgz
tar xzf x86_64-linux-musl-native.tgz -C /opt
cmake .
make
- name: Compress
uses: svenstaro/upx-action@v2
with:
file: termtunnel
- name: Packing
run: |
mv termtunnel termtunnel-linux-amd64
tar -czf termtunnel-linux-amd64.tar.gz termtunnel-linux-amd64
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-linux-amd64
path: termtunnel-linux-amd64
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-linux-amd64.tar.gz
asset_name: termtunnel-${{ github.event.inputs.version }}-linux-amd64.tar.gz
asset_content_type: application/octet-stream
create_linux_i686_static_release:
needs: create_release
name: Create static linux i686 release
runs-on: ubuntu-latest
env:
CC: /opt/i686-linux-musl-native/bin/i686-linux-musl-gcc
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: |
curl -O http://musl.cc/i686-linux-musl-native.tgz
tar xzf i686-linux-musl-native.tgz -C /opt
sudo apt install -y gcc-multilib
cmake .
make CFLAGS="-m32"
- name: Packing
run: |
mv termtunnel termtunnel-linux-i686
tar -czf termtunnel-linux-i686.tar.gz termtunnel-linux-i686
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-linux-i686
path: termtunnel-linux-i686
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-linux-i686.tar.gz
asset_name: termtunnel-${{ github.event.inputs.version }}-linux-i686.tar.gz
asset_content_type: application/octet-stream
create_darwin_amd64_static_release:
needs: create_release
runs-on: macos-latest
name: Create darwin amd64 release
steps:
- name: Install external dependencies with homebrew
run: |
brew install cmake make gcc
- name: Clone repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: |
cmake .
make
mv termtunnel termtunnel-darwin-amd64
zip termtunnel-darwin-amd64.zip termtunnel-darwin-amd64
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-darwin-amd64
path: termtunnel-darwin-amd64
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-darwin-amd64.zip
asset_name: termtunnel-${{ github.event.inputs.version }}-darwin-amd64.zip
asset_content_type: application/octet-stream
create_linux_aarch64_static_release:
needs: create_release
name: Create static linux aarch64 release
runs-on: ubuntu-18.04
env:
CC: /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare cross-compiler
run: |
curl -O http://musl.cc/aarch64-linux-musl-cross.tgz
tar xzf aarch64-linux-musl-cross.tgz -C /opt
- run: /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version
- name: Build
run: |
cmake .
make
- name: Packing
run: |
mv termtunnel termtunnel-linux-aarch64
tar -czf termtunnel-linux-aarch64.tar.gz termtunnel-linux-aarch64
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-linux-aarch64
path: termtunnel-linux-aarch64
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-linux-aarch64.tar.gz
asset_name: termtunnel-${{ github.event.inputs.version }}-linux-aarch64.tar.gz
asset_content_type: application/octet-stream
create_linux_arm_static_release:
needs: create_release
name: Create static linux armeabi release
runs-on: ubuntu-18.04
env:
CC: /opt/arm-linux-musleabi-cross/bin/arm-linux-musleabi-gcc
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare cross-compiler
run: |
curl -O http://musl.cc/arm-linux-musleabi-cross.tgz
tar xzf arm-linux-musleabi-cross.tgz -C /opt
- run: /opt/arm-linux-musleabi-cross/bin/arm-linux-musleabi-gcc --version
- name: Build
run: |
cmake .
make
- name: Packing
run: |
mv termtunnel termtunnel-linux-armeabi
tar -czf termtunnel-linux-armeabi.tar.gz termtunnel-linux-armeabi
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-linux-armeabi
path: termtunnel-linux-armeabi
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-linux-armeabi.tar.gz
asset_name: termtunnel-${{ github.event.inputs.version }}-linux-armeabi.tar.gz
asset_content_type: application/octet-stream
create_linux_mips64le_static_release:
needs: create_release
name: Create static linux mips64el release
runs-on: ubuntu-18.04
env:
CC: /opt/mips64el-linux-musl-cross/bin/mips64el-linux-musl-gcc
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare cross-compiler
run: |
curl -O http://musl.cc/mips64el-linux-musl-cross.tgz
tar xzf mips64el-linux-musl-cross.tgz -C /opt
- run: /opt/mips64el-linux-musl-cross/bin/mips64el-linux-musl-gcc --version
- name: Build
run: |
cmake .
make
- name: Packing
run: |
mv termtunnel termtunnel-linux-mips64el
tar -czf termtunnel-linux-mips64el.tar.gz termtunnel-linux-mips64el
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: termtunnel-linux-mips64el
path: termtunnel-linux-mips64el
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: termtunnel-linux-mips64el.tar.gz
asset_name: termtunnel-${{ github.event.inputs.version }}-linux-mips64el.tar.gz
asset_content_type: application/octet-stream