Skip to content

Commit 7307a0e

Browse files
authored
Add macOS code signing, notarization, and SHA-256 checksums to Bun compile workflow (#99)
1 parent e588669 commit 7307a0e

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

.github/workflows/bun-compile.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@ on:
1818

1919
jobs:
2020
build:
21-
runs-on: ubuntu-latest
21+
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
2424
include:
2525
- target: bun-darwin-arm64
26+
os: macos-latest
2627
output: auggie-darwin-arm64
2728
artifact: auggie-darwin-arm64
2829
- target: bun-darwin-x64
30+
os: macos-latest
2931
output: auggie-darwin-x64
3032
artifact: auggie-darwin-x64
3133
- target: bun-linux-x64
34+
os: ubuntu-latest
3235
output: auggie-linux-x64
3336
artifact: auggie-linux-x64
3437
- target: bun-windows-x64
38+
os: ubuntu-latest
3539
output: auggie-windows-x64.exe
3640
artifact: auggie-windows-x64
3741
permissions:
@@ -57,6 +61,42 @@ jobs:
5761
- name: Compile binary
5862
run: bun build augment.mjs --compile --target=${{ matrix.target }} --outfile=${{ matrix.output }}
5963

64+
- name: Import code signing certificate
65+
if: contains(matrix.target, 'darwin')
66+
env:
67+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
68+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
69+
run: |
70+
echo "$APPLE_CERTIFICATE" | base64 --decode > certificate.p12
71+
security create-keychain -p "temppass" build.keychain
72+
security default-keychain -s build.keychain
73+
security unlock-keychain -p "temppass" build.keychain
74+
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
75+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "temppass" build.keychain
76+
rm -f certificate.p12
77+
78+
- name: Sign binary
79+
if: contains(matrix.target, 'darwin')
80+
run: |
81+
IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID" | head -1 | sed 's/.*"\(.*\)".*/\1/')
82+
if [ -z "$IDENTITY" ]; then
83+
echo "::error::No Developer ID signing identity found in build.keychain"
84+
exit 1
85+
fi
86+
echo "Signing with identity: $IDENTITY"
87+
codesign --force --options runtime --timestamp --sign "$IDENTITY" ${{ matrix.output }}
88+
89+
- name: Notarize binary
90+
if: contains(matrix.target, 'darwin')
91+
env:
92+
APPLE_ID: ${{ secrets.APPLE_ID }}
93+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
94+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
95+
run: |
96+
zip "${{ matrix.output }}.zip" "${{ matrix.output }}"
97+
xcrun notarytool submit "${{ matrix.output }}.zip" --apple-id "$APPLE_ID" --password "$APPLE_APP_SPECIFIC_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
98+
rm -f "${{ matrix.output }}.zip"
99+
60100
- name: Upload artifact
61101
uses: actions/upload-artifact@v4
62102
with:
@@ -75,6 +115,12 @@ jobs:
75115
path: artifacts
76116
merge-multiple: true
77117

118+
- name: Generate checksums
119+
run: |
120+
cd artifacts
121+
sha256sum auggie-* > checksums.txt
122+
cat checksums.txt
123+
78124
- name: Create GitHub Release
79125
env:
80126
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)