Skip to content

Commit 1478be4

Browse files
authored
Windows codesigning (#4)
1 parent 300a2f6 commit 1478be4

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/build.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
sudo apt-get update
24-
sudo apt-get install libftdi1-dev mingw-w64
24+
sudo apt-get install libftdi1-dev mingw-w64 osslsigncode
2525
# Build libusb from source. This is required to disable usage of udev
2626
# which in turns simplify static linking because Ubuntu doesn't ship with
2727
# a static version of udev (and that would require recompiling systemd).
@@ -38,29 +38,34 @@ jobs:
3838
sudo make install
3939
- name: Build Linux
4040
run: |
41-
go build --tags 'netgo osusergo' -ldflags '-s -w -extldflags "-static"'
41+
go build -v --tags 'netgo osusergo' -ldflags '-s -w -extldflags "-static"'
4242
tar cvzf g64drive-linux-amd64.tar.gz g64drive
4343
env:
4444
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
4545
- name: Upload Linux binary
4646
uses: actions/upload-artifact@v3
4747
with:
48-
name: g64drive-linux-amd64.tar.gz
49-
path: g64drive-linux-amd64.tar.gz
48+
name: g64drive-linux-amd64
49+
path: g64drive
5050
- name: Build Windows
5151
run: |
52-
go build -ldflags '-s -w'
52+
go build -v -ldflags '-s -w' -o g64drive.unsigned.exe
53+
echo "$WIN_CERTIFICATE_KEY" | base64 --decode > cert.key
54+
echo "$WIN_CERTIFICATE_PUB" | base64 --decode > cert.pub
55+
osslsigncode sign -certs cert.pub -key cert.key -t http://timestamp.digicert.com -in g64drive.unsigned.exe -out g64drive.exe
5356
zip -9 g64drive-windows-amd64.zip g64drive.exe
5457
env:
5558
GOOS: windows
5659
GOARCH: amd64
5760
CGO_ENABLED: 1
5861
CC: "x86_64-w64-mingw32-gcc"
62+
WIN_CERTIFICATE_KEY: ${{ secrets.WIN_CERTIFICATE_KEY }}
63+
WIN_CERTIFICATE_PUB: ${{ secrets.WIN_CERTIFICATE_PUB }}
5964
- name: Upload Windows binary
6065
uses: actions/upload-artifact@v3
6166
with:
62-
name: g64drive-windows-amd64.zip
63-
path: g64drive-windows-amd64.zip
67+
name: g64drive-windows-amd64
68+
path: g64drive.exe
6469
- name: Release
6570
uses: softprops/action-gh-release@v1
6671
if: startsWith(github.ref, 'refs/tags/')
@@ -94,13 +99,13 @@ jobs:
9499
sed -i.bak "s|$SED_SEARCH|$SED_REPLACE1\\n$SED_REPLACE2|" vendor/github.com/ziutek/ftdi/device.go
95100
- name: Build
96101
run: |
97-
go build -ldflags '-s -w'
102+
go build -v -ldflags '-s -w'
98103
zip -9 g64drive-mac-amd64.zip g64drive
99104
- name: Upload Linux binary
100105
uses: actions/upload-artifact@v3
101106
with:
102-
name: g64drive-mac-amd64.zip
103-
path: g64drive-mac-amd64.zip
107+
name: g64drive-mac-amd64
108+
path: g64drive
104109
- name: Release
105110
uses: softprops/action-gh-release@v1
106111
if: startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)