41
41
build-binaries :
42
42
strategy :
43
43
matrix :
44
- os : [linux, darwin, freebsd, windows]
45
- arch : [amd64, arm64]
44
+ include :
45
+ - runner : macos-latest
46
+ os : darwin
47
+ arch : arm64
48
+ - runner : ubuntu-latest
49
+ os : freebsd
50
+ arch : amd64
51
+ - runner : ubuntu-latest
52
+ os : freebsd
53
+ arch : arm64
54
+ - runner : ubuntu-latest
55
+ os : linux
56
+ arch : amd64
57
+ - runner : ubuntu-latest
58
+ os : linux
59
+ arch : arm64
60
+ - runner : ubuntu-latest
61
+ os : windows
62
+ arch : amd64
63
+ - runner : ubuntu-latest
64
+ os : windows
65
+ arch : arm64
66
+ runs-on : ${{ matrix.runner }}
46
67
runs-on : ubuntu-latest
47
68
needs : [create-draft-release]
48
69
permissions :
@@ -61,24 +82,27 @@ jobs:
61
82
- uses : actions/setup-go@v5
62
83
with :
63
84
go-version : 1.22.x
85
+ - name : Build binary
86
+ run : GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
87
+
88
+ # Sign Windows build
64
89
- name : Set up Java
65
90
uses : actions/setup-java@v4
91
+ if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows' }}
66
92
with :
67
93
java-version : 17
68
94
distribution : ' temurin'
69
- - name : Build binary
70
- run : GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
71
95
- id : ' auth'
72
96
name : Authenticate with Google Cloud
73
- if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows'
97
+ if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows' }}
74
98
uses : ' google-github-actions/auth@v2'
75
99
with :
76
100
credentials_json : ' ${{ secrets.CERTIFICATE_SA_CREDENTIALS }}'
77
101
- name : Set up Cloud SDK
78
- if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows'
102
+ if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows' }}
79
103
uses : ' google-github-actions/setup-gcloud@v2'
80
104
- name : Sign windows binary
81
- if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows'
105
+ if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows' }}
82
106
run : |
83
107
echo "Downloading jsign.jar"
84
108
curl -L -o jsign.jar https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar
@@ -103,19 +127,68 @@ jobs:
103
127
echo "Signed Windows binary: ${_filename}"
104
128
echo "Cleaning up certificate chain"
105
129
rm -f codesign-chain.pem
130
+
131
+ # Sign MacOS build
132
+
133
+ - name : Create .app package and sign macos binary
134
+ if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'darwin' }}
135
+ run : |
136
+ echo "Decoding and importing Apple certificate..."
137
+ echo -n "${{ secrets.APPLE_CERTIFICATE }}" | base64 --decode -o apple_certificate.p12
138
+ security create-keychain -p "${{ secrets.APPLE_KEYCHAIN_PASSWORD }}" build.keychain
139
+ security default-keychain -s build.keychain
140
+ security set-keychain-settings -lut 21600 build.keychain
141
+ security unlock-keychain -p "${{ secrets.APPLE_KEYCHAIN_PASSWORD }}" build.keychain
142
+ security import apple_certificate.p12 -k build.keychain -P "${{ secrets.APPLE_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign
143
+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.APPLE_KEYCHAIN_PASSWORD }}" build.keychain
144
+ echo "Packaging adder..."
145
+ mkdir -p Adder.app/Contents/MacOS
146
+ mkdir -p Adder.app/Contents/Resources
147
+ cp adder Adder.app/Contents/MacOS/adder
148
+ chmod +x Adder.app/Contents/MacOS/adder
149
+ cat <<EOF > Adder.app/Contents/Info.plist
150
+ <?xml version="1.0" encoding="UTF-8"?>
151
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
152
+ <plist version="1.0">
153
+ <dict>
154
+ <key>CFBundleExecutable</key>
155
+ <string>adder</string>
156
+ <key>CFBundleIdentifier</key>
157
+ <string>com.blinklabssoftware.adder</string>
158
+ <key>CFBundleName</key>
159
+ <string>Adder</string>
160
+ <key>CFBundleVersion</key>
161
+ <string>${{ env.RELEASE_TAG }}</string>
162
+ <key>CFBundleShortVersionString</key>
163
+ <string>${{ env.RELEASE_TAG }}</string>
164
+ </dict>
165
+ </plist>
166
+ EOF
167
+ /usr/bin/codesign --force -s "Developer ID Application: Blink Labs Software (${{ secrets.APPLE_TEAM_ID }})" --options runtime Adder.app -v
168
+ xcrun notarytool store-credentials "notarytool-profile" --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAM_ID }}" --password "${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}"
169
+ ditto -c -k --keepParent "Adder.app" "notarization.zip"
170
+ xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
171
+ xcrun stapler staple "Adder.app"
106
172
- name : Upload release asset
107
173
if : startsWith(github.ref, 'refs/tags/')
108
174
run : |
109
175
_filename=adder-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}
110
- if [[ ${{ matrix.os }} == windows ]]; then
176
+ if [[ " ${{ matrix.os }}" == " windows" ]]; then
111
177
_filename=${_filename}.exe
112
178
fi
113
- cp adder ${_filename}
179
+ if [[ "${{ matrix.os }}" == "windows" || "${{ matrix.os }}" == "linux" ]]; then
180
+ cp adder ${_filename}
181
+ fi
182
+ if [[ "${{ matrix.os }}" == "darwin" ]]; then
183
+ _filename=adder-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.zip
184
+ zip -r ${_filename} Adder.app
185
+ fi
114
186
curl \
115
187
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
116
188
-H "Content-Type: application/octet-stream" \
117
189
--data-binary @${_filename} \
118
190
https://uploads.github.com/repos/${{ github.repository_owner }}/adder/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
191
+
119
192
- name : Attest binary
120
193
uses : actions/attest-build-provenance@v2
121
194
with :
0 commit comments