-
Notifications
You must be signed in to change notification settings - Fork 36
344 lines (331 loc) · 14.7 KB
/
package.yaml
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: Package
concurrency:
group: package-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'pkg/*'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Set tag
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_TAG_NAME}}
release_name: ${{ env.GIT_TAG_NAME}}
draft: true
prerelease: true
package-for-linux:
name: package-for-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Env
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Build and package ckb-cli
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
docker run --rm -i -w /ckb-cli -v $(pwd):/ckb-cli -e OPENSSL_STATIC=1 $BUILDER_IMAGE make prod
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg
gpg --import devtools/ci/signer.asc
devtools/ci/package.sh target/release/ckb-cli
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }}
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }}
- name: upload-zip-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-asc-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
BUILDER_IMAGE: nervos/ckb-docker-builder:bionic-rust-1.51.0
REL_PKG: x86_64-unknown-linux-gnu.tar.gz
package-for-linux-aarch64:
name: package-for-linux-aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Env
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Add rust target
run: rustup target add aarch64-unknown-linux-gnu
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gcc-multilib && sudo apt-get install -y build-essential clang gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Build and package ckb-cli (aarch64)
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
export TOP_DIR=$(pwd)
curl -LO https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar -xzf openssl-1.1.1.tar.gz
cd openssl-1.1.1
CC=aarch64-linux-gnu-gcc ./Configure linux-aarch64 no-shared
CC=aarch64-linux-gnu-gcc make
cd ..
export OPENSSL_LIB_DIR=${TOP_DIR}/openssl-1.1.1
export OPENSSL_INCLUDE_DIR=${TOP_DIR}/openssl-1.1.1/include
PKG_CONFIG_ALLOW_CROSS=1 OPENSSL_STATIC=1 CC=gcc CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc cargo build --target=aarch64-unknown-linux-gnu --release
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg
gpg --import devtools/ci/signer.asc
devtools/ci/package.sh target/aarch64-unknown-linux-gnu/release/ckb-cli
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }}
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }}
- name: upload-zip-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-asc-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
REL_PKG: aarch64-unknown-linux-gnu.tar.gz
package-for-centos:
name: package-for-centos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Env
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Build and package ckb-cli
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
docker run --rm -i -w /ckb-cli -v $(pwd):/ckb-cli $BUILDER_IMAGE make prod
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg
gpg --import devtools/ci/signer.asc
devtools/ci/package.sh target/release/ckb-cli
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }}
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }}
- name: upload-zip-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-asc-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
BUILDER_IMAGE: nervos/ckb-docker-builder:centos-7-rust-1.51.0
REL_PKG: x86_64-unknown-centos-gnu.tar.gz
package-for-mac:
name: package-for-mac
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set Env
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Build and package ckb-cli
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
make OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/local/opt/[email protected]/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/[email protected]/include prod
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg
gpg --import devtools/ci/signer.asc
devtools/ci/package.sh target/release/ckb-cli
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }}
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }}
- name: upload-zip-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-asc-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
REL_PKG: x86_64-apple-darwin.zip
package-for-mac-aarch64:
name: package-for-mac-aarch64
runs-on: [self-hosted, macOS, ARM64]
steps:
- name: Setup PATH
run: |
echo /opt/homebrew/bin >> $GITHUB_PATH
echo /opt/homebrew/sbin >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Depedencies
run: |
if ! [ -d /opt/homebrew/opt/[email protected] ]; then
brew install "[email protected]"
fi
if ! type -f gpg &> /dev/null; then
brew install gnupg
fi
if ! [ -f "$HOME/.cargo/bin/rustup" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
- uses: actions/checkout@v2
- name: Set Env
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Build and package ckb-cli
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
make OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/local/opt/[email protected]/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/[email protected]/include prod
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg
gpg --import devtools/ci/signer.asc
devtools/ci/package.sh target/release/ckb-cli
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }}
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }}
- name: upload-zip-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-asc-file
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
REL_PKG: aarch64-apple-darwin.zip
package-for-windows:
name: package-for-windows
runs-on: windows-2019
steps:
- name: Install Dependencies
run: |
iwr -useb get.scoop.sh -outfile 'install-scoop.ps1'
.\install-scoop.ps1 -RunAsAdmin
echo "LIBCLANG_PATH=$($HOME)/scoop/apps/llvm/current/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
scoop install llvm yasm
echo ("GIT_TAG_NAME=" + $env:GITHUB_REF.replace('refs/heads/pkg/', '')) >> $env:GITHUB_ENV
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "LIBCLANG_PATH=$env:USERPROFILE\scoop\apps\llvm\current\bin" >> $env:GITHUB_ENV
- uses: actions/checkout@v2
- name: Build
run: |
make prod
- name: Prepare archive
run: |
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3]
mkdir ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc
cp -r target/release/ckb-cli.exe,README.md,CHANGELOG.md,COPYING ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc
- name: Archive Files
run: |
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3]
Compress-Archive -Path ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc -DestinationPath ckb-cli_$($env:GIT_TAG_NAME)_$($env:REL_PKG)
- name: Sign Archive
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
GPG_SIGNER: ${{ secrets.GPG_SIGNER }}
run: |
$CYGPWD = cygpath -u (Get-Location)
gpg --quiet --batch --yes --decrypt --passphrase="$env:LARGE_SECRET_PASSPHRASE" --output "$CYGPWD/devtools/ci/signer.asc" "$CYGPWD/devtools/ci/signer.asc.gpg"
gpg --import "$CYGPWD/devtools/ci/signer.asc"
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3]
gpg -u "$env:GPG_SIGNER" -ab "$CYGPWD/ckb-cli_$($env:GIT_TAG_NAME)_$($env:REL_PKG)"
- name: upload-artifact
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}
- name: upload-artifact
uses: actions/upload-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc
env:
REL_PKG: x86_64-pc-windows-msvc.zip
Upload_File:
name: Upload_Zip_File
runs-on: ubuntu-latest
strategy:
matrix:
include:
- REL_PKG: x86_64-unknown-linux-gnu.tar.gz
- REL_PKG: aarch64-unknown-linux-gnu.tar.gz
- REL_PKG: x86_64-unknown-centos-gnu.tar.gz
- REL_PKG: x86_64-apple-darwin.zip
- REL_PKG: aarch64-apple-darwin.zip
- REL_PKG: x86_64-pc-windows-msvc.zip
needs:
- create-release
- package-for-linux
- package-for-linux-aarch64
- package-for-mac
- package-for-mac-aarch64
- package-for-windows
- package-for-centos
steps:
- uses: actions/checkout@v2
- name: Set tag
run: |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV
- name: Prepare - Download tar
uses: actions/download-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}
- name: Prepare - Download asc
uses: actions/download-artifact@v2
with:
name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}.asc
- name: Upload tar assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}
asset_path: ${{ github.workspace }}/ckb-cli_${{env.GIT_TAG_NAME }}_${{ matrix.REL_PKG }}
asset_content_type: application/octet-stream
- name: Upload asc assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}.asc
asset_path: ${{ github.workspace }}/ckb-cli_${{env.GIT_TAG_NAME }}_${{ matrix.REL_PKG }}.asc
asset_content_type: application/octet-stream