-
Notifications
You must be signed in to change notification settings - Fork 44
484 lines (432 loc) · 18 KB
/
release.yml
File metadata and controls
484 lines (432 loc) · 18 KB
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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
name: Release
on:
push:
tags:
- 'v*'
env:
GO_VERSION: '1.26.1'
MUSL_RELEASE: 'v1.3.29'
MODULE: github.com/skycoin/skywire
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--repo ${{ github.repository }} \
--title "${{ github.ref_name }}" \
--draft \
--generate-notes || true
linux:
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
goarch: amd64
toolchain: x86_64-linux-musl
toolchain_file: x86_64-linux-musl-cross.tgz
- arch: arm64
goarch: arm64
toolchain: aarch64-linux-musl
toolchain_file: aarch64-linux-musl-cross.tgz
- arch: arm
goarch: arm
goarm: "6"
toolchain: arm-linux-musleabi
toolchain_file: arm-linux-musleabi-cross.tgz
- arch: armhf
goarch: arm
goarm: "7"
toolchain: arm-linux-musleabihf
toolchain_file: arm-linux-musleabihf-cross.tgz
- arch: 386
goarch: "386"
toolchain: i686-linux-musl
toolchain_file: i686-linux-musl-cross.tgz
- arch: riscv64
goarch: riscv64
toolchain: riscv64-linux-musl
toolchain_file: riscv64-linux-musl-cross.tgz
steps:
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y wget tar libusb-1.0-0-dev autoconf automake libtool
- name: Fetch build-libusb-musl.sh
run: |
curl -sL "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/ci_scripts/build-libusb-musl.sh" -o build-libusb-musl.sh
chmod +x build-libusb-musl.sh
- name: Cache musl toolchain
id: cache-toolchain
uses: actions/cache@v5
with:
path: musl-data
key: musl-${{ env.MUSL_RELEASE }}-${{ matrix.toolchain }}
- name: Download musl toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
mkdir -p musl-data
wget -q "https://github.com/skycoin/skywire/releases/download/${{ env.MUSL_RELEASE }}/${{ matrix.toolchain_file }}"
tar -xzf "${{ matrix.toolchain_file }}" -C ./musl-data
rm "${{ matrix.toolchain_file }}"
- name: Build libusb for musl target
run: ./build-libusb-musl.sh ${{ matrix.arch }} ${{ matrix.toolchain }} ./musl-data/${{ matrix.toolchain }}-cross
- name: Build skywire release binary
env:
GOPROXY: direct
GOSUMDB: "off"
CGO_ENABLED: "1"
CC: ${{ github.workspace }}/musl-data/${{ matrix.toolchain }}-cross/bin/${{ matrix.toolchain }}-gcc
PKG_CONFIG_PATH: ${{ github.workspace }}/musl-data/${{ matrix.toolchain }}-cross/${{ matrix.toolchain }}/lib/pkgconfig
GOOS: linux
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
go install -tags="cgo,withoutsystray" -trimpath \
-ldflags "-s -w -linkmode external -extldflags '-static' -buildid=" \
${{ env.MODULE }}@${{ github.ref_name }}
mkdir -p bin
GOPATH_BIN="$(go env GOPATH)/bin"
if [ -f "${GOPATH_BIN}/linux_${{ matrix.goarch }}/skywire" ]; then
cp "${GOPATH_BIN}/linux_${{ matrix.goarch }}/skywire" bin/skywire
elif [ -f "${GOPATH_BIN}/skywire" ]; then
cp "${GOPATH_BIN}/skywire" bin/skywire
else
echo "Binary not found in expected locations"
find "${GOPATH_BIN}" -name "skywire*" -type f
exit 1
fi
# Verify binary on native arch
if [ "${{ matrix.arch }}" = "amd64" ]; then
./bin/skywire || true
./bin/skywire skycoin || true
fi
- name: Create archive
run: |
ARCHIVE_NAME="skywire-${{ github.ref_name }}-linux-${{ matrix.arch }}"
mkdir -p dist
cp bin/skywire dist/
cd dist
tar -czvf "${ARCHIVE_NAME}.tar.gz" skywire
sha256sum "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" \
dist/skywire-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz \
dist/skywire-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz.sha256 \
--repo ${{ github.repository }} \
--clobber
darwin-amd64:
needs: create-release
runs-on: macos-15-intel
steps:
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install Requirements
run: |
brew install --quiet libusb || brew upgrade --quiet libusb
brew install --quiet hidapi || brew upgrade --quiet hidapi
- name: Build skywire
env:
GOPROXY: direct
GOSUMDB: "off"
CGO_ENABLED: "1"
CGO_CFLAGS: -I/usr/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/hidapi/include -I/opt/homebrew/opt/libusb/include
CGO_LDFLAGS: -L/usr/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/hidapi/lib -L/opt/homebrew/opt/libusb/lib
run: |
go install -trimpath -ldflags "-s -w" \
${{ env.MODULE }}@${{ github.ref_name }}
mkdir -p bin
cp "$(go env GOPATH)/bin/skywire" bin/skywire
./bin/skywire || true
./bin/skywire skycoin || true
- name: Create archive
run: |
ARCHIVE_NAME="skywire-${{ github.ref_name }}-darwin-amd64"
mkdir -p dist
cp bin/skywire dist/
cd dist
tar -czvf "${ARCHIVE_NAME}.tar.gz" skywire
shasum -a 256 "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
- name: Create macOS package
run: |
PKG_NAME="skywire-${{ github.ref_name }}-darwin-amd64"
mkdir -p pkg-root/usr/local/bin
cp bin/skywire pkg-root/usr/local/bin/
pkgbuild --root pkg-root \
--identifier com.skycoin.skywire \
--version "${{ github.ref_name }}" \
--install-location / \
"dist/${PKG_NAME}.pkg"
shasum -a 256 "dist/${PKG_NAME}.pkg" > "dist/${PKG_NAME}.pkg.sha256"
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" \
dist/skywire-${{ github.ref_name }}-darwin-amd64.tar.gz \
dist/skywire-${{ github.ref_name }}-darwin-amd64.tar.gz.sha256 \
dist/skywire-${{ github.ref_name }}-darwin-amd64.pkg \
dist/skywire-${{ github.ref_name }}-darwin-amd64.pkg.sha256 \
--repo ${{ github.repository }} \
--clobber
darwin-arm64:
needs: create-release
runs-on: macos-latest
steps:
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install Requirements
run: |
brew install --quiet libusb || brew upgrade --quiet libusb
brew install --quiet hidapi || brew upgrade --quiet hidapi
- name: Build skywire
env:
GOPROXY: direct
GOSUMDB: "off"
CGO_ENABLED: "1"
CGO_CFLAGS: -I/opt/homebrew/include -I/opt/homebrew/opt/hidapi/include -I/opt/homebrew/opt/libusb/include
CGO_LDFLAGS: -L/opt/homebrew/lib -L/opt/homebrew/opt/hidapi/lib -L/opt/homebrew/opt/libusb/lib
run: |
go install -trimpath -ldflags "-s -w" \
${{ env.MODULE }}@${{ github.ref_name }}
mkdir -p bin
cp "$(go env GOPATH)/bin/skywire" bin/skywire
./bin/skywire || true
./bin/skywire skycoin || true
- name: Create archive
run: |
ARCHIVE_NAME="skywire-${{ github.ref_name }}-darwin-arm64"
mkdir -p dist
cp bin/skywire dist/
cd dist
tar -czvf "${ARCHIVE_NAME}.tar.gz" skywire
shasum -a 256 "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
- name: Create macOS package
run: |
PKG_NAME="skywire-${{ github.ref_name }}-darwin-arm64"
mkdir -p pkg-root/usr/local/bin
cp bin/skywire pkg-root/usr/local/bin/
pkgbuild --root pkg-root \
--identifier com.skycoin.skywire \
--version "${{ github.ref_name }}" \
--install-location / \
"dist/${PKG_NAME}.pkg"
shasum -a 256 "dist/${PKG_NAME}.pkg" > "dist/${PKG_NAME}.pkg.sha256"
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" \
dist/skywire-${{ github.ref_name }}-darwin-arm64.tar.gz \
dist/skywire-${{ github.ref_name }}-darwin-arm64.tar.gz.sha256 \
dist/skywire-${{ github.ref_name }}-darwin-arm64.pkg \
dist/skywire-${{ github.ref_name }}-darwin-arm64.pkg.sha256 \
--repo ${{ github.repository }} \
--clobber
windows:
needs: create-release
runs-on: windows-latest
strategy:
matrix:
include:
- arch: amd64
goarch: amd64
wix_arch: x64
wintun_arch: amd64
- arch: "386"
goarch: "386"
wix_arch: x86
wintun_arch: x86
- arch: arm64
goarch: arm64
wix_arch: x64
wintun_arch: arm64
steps:
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install CGO Requirements
if: matrix.arch == 'amd64'
shell: pwsh
run: |
C:\msys64\usr\bin\bash.exe -lc "pacman -S --noconfirm mingw-w64-x86_64-libusb mingw-w64-x86_64-hidapi mingw-w64-x86_64-pkg-config"
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Fetch Windows installer files
if: matrix.arch != 'arm64'
shell: pwsh
run: |
$base = "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/scripts/win_installer"
New-Item -ItemType Directory -Force -Path "scripts\win_installer\images"
Invoke-WebRequest "$base/Product.wxs" -OutFile "scripts\win_installer\Product.wxs"
Invoke-WebRequest "$base/UI.wxs" -OutFile "scripts\win_installer\UI.wxs"
Invoke-WebRequest "$base/skywire.bat" -OutFile "scripts\win_installer\skywire.bat"
Invoke-WebRequest "$base/images/Banner.png" -OutFile "scripts\win_installer\images\Banner.png"
Invoke-WebRequest "$base/images/Dialog.png" -OutFile "scripts\win_installer\images\Dialog.png"
Invoke-WebRequest "$base/images/ico.ico" -OutFile "scripts\win_installer\images\ico.ico"
- name: Build skywire
env:
GOPROXY: direct
GOSUMDB: "off"
GOOS: windows
GOARCH: ${{ matrix.goarch }}
shell: pwsh
run: |
# Compile from repo root (not cmd/release) because cmd/release imports
# hardware wallet which requires libusb/libhidapi DLLs on Windows.
# The hw wallet is built separately below with the required DLLs.
go install -trimpath -ldflags "-s -w" "${{ env.MODULE }}@${{ github.ref_name }}"
New-Item -ItemType Directory -Force -Path "bin"
$gopath = go env GOPATH
$crossPath = "$gopath\bin\windows_${{ matrix.goarch }}\skywire.exe"
$nativePath = "$gopath\bin\skywire.exe"
if (Test-Path $crossPath) {
Copy-Item $crossPath "bin\skywire.exe"
} elseif (Test-Path $nativePath) {
Copy-Item $nativePath "bin\skywire.exe"
} else {
Write-Error "Binary not found"
Get-ChildItem -Recurse "$gopath\bin" -Filter "skywire*"
exit 1
}
# Verify binary (amd64 and 386 can run on amd64 runner)
if ("${{ matrix.arch }}" -ne "arm64") {
& "bin\skywire.exe"
& "bin\skywire.exe" skycoin
}
- name: Build hardware wallet utility
if: matrix.arch == 'amd64'
env:
GOPROXY: direct
GOSUMDB: "off"
CGO_ENABLED: "1"
CGO_CFLAGS: -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/libusb-1.0
CGO_LDFLAGS: -LC:/msys64/mingw64/lib
GOOS: windows
GOARCH: amd64
shell: pwsh
run: |
go install -trimpath -ldflags "-s -w" github.com/skycoin/skycoin/cmd/hardware-wallet@latest
$gopath = go env GOPATH
$hwPath = "$gopath\bin\hardware-wallet.exe"
if (Test-Path $hwPath) {
Copy-Item $hwPath "bin\skyhw.exe"
} else {
Write-Warning "Hardware wallet binary not found, skipping"
}
- name: Create archive
shell: pwsh
run: |
$ARCHIVE_NAME = "skywire-${{ github.ref_name }}-windows-${{ matrix.arch }}"
New-Item -ItemType Directory -Force -Path "dist"
Copy-Item "bin\skywire.exe" "dist\"
# Include hardware wallet binary and required DLLs if present
if (Test-Path "bin\skyhw.exe") {
Copy-Item "bin\skyhw.exe" "dist\"
# Bundle required DLLs for the CGO hardware wallet binary
$dllDir = "C:\msys64\mingw64\bin"
foreach ($dll in @("libhidapi-0.dll", "libusb-1.0.dll")) {
$dllPath = "$dllDir\$dll"
if (Test-Path $dllPath) {
Copy-Item $dllPath "dist\"
}
}
}
Compress-Archive -Path "dist\*" -DestinationPath "dist\$ARCHIVE_NAME.zip"
Get-FileHash "dist\$ARCHIVE_NAME.zip" -Algorithm SHA256 | ForEach-Object { "$($_.Hash) $ARCHIVE_NAME.zip" } > "dist\$ARCHIVE_NAME.zip.sha256"
Get-ChildItem "dist\" -Exclude "*.zip","*.sha256" | Remove-Item
- name: Create MSI installer
if: matrix.arch != 'arm64'
shell: pwsh
run: |
$MSI_NAME = "skywire-installer-${{ github.ref_name }}-windows-${{ matrix.arch }}"
$VERSION = "${{ github.ref_name }}" -replace '(^v|-.+$)', ''
# Download WiX 3.11
Invoke-WebRequest "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip" -OutFile wix.zip
Expand-Archive wix.zip -DestinationPath wix
# Download wintun
Invoke-WebRequest "https://www.wintun.net/builds/wintun-0.14.1.zip" -OutFile wintun.zip
Expand-Archive wintun.zip -DestinationPath wintun_extracted
# Prepare build directory
Set-Location scripts\win_installer
New-Item -ItemType Directory -Force -Path "build\apps"
Copy-Item ..\..\bin\skywire.exe build\skywire.exe
Copy-Item skywire.bat build\skywire.bat
New-Item -ItemType File -Path "build\new.update"
Copy-Item ..\..\wintun_extracted\wintun\bin\${{ matrix.wintun_arch }}\wintun.dll build\wintun.dll
# Update version in Product.wxs
$productWxs = Get-Content -Path Product.wxs -Raw
$productWxs = $productWxs -replace "skywireVersion", $VERSION
Set-Content -Path Product.wxs -Value $productWxs
# Build MSI
..\..\wix\candle.exe UI.wxs Product.wxs -arch ${{ matrix.wix_arch }}
..\..\wix\light.exe -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -out skywire.msi UI.wixobj Product.wixobj
Move-Item skywire.msi ..\..\dist\$MSI_NAME.msi
Set-Location ..\..
Get-FileHash "dist\$MSI_NAME.msi" -Algorithm SHA256 | ForEach-Object { "$($_.Hash) $MSI_NAME.msi" } > "dist\$MSI_NAME.msi.sha256"
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
run: |
$files = @(
"dist\skywire-${{ github.ref_name }}-windows-${{ matrix.arch }}.zip",
"dist\skywire-${{ github.ref_name }}-windows-${{ matrix.arch }}.zip.sha256"
)
$msi = "dist\skywire-installer-${{ github.ref_name }}-windows-${{ matrix.arch }}.msi"
$msiSha = "dist\skywire-installer-${{ github.ref_name }}-windows-${{ matrix.arch }}.msi.sha256"
if (Test-Path $msi) {
$files += $msi
$files += $msiSha
}
gh release upload "${{ github.ref_name }}" @files --repo ${{ github.repository }} --clobber
docker:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Build and push Docker image
run: |
make docker-push-test
# Also tag with the release version
docker tag skycoin/skywire:test "skycoin/skywire:${{ github.ref_name }}"
docker push "skycoin/skywire:${{ github.ref_name }}"
shell: bash
create-checksums:
needs: [linux, darwin-amd64, darwin-arm64, windows]
runs-on: ubuntu-latest
steps:
- name: Download all checksums and create combined file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download "${{ github.ref_name }}" --repo ${{ github.repository }} --pattern "*.sha256"
cat *.sha256 > checksums.txt
- name: Upload combined checksums
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" checksums.txt \
--repo ${{ github.repository }} \
--clobber