Skip to content

Commit 5cdf299

Browse files
committed
add macos sign step
1 parent 098d1f8 commit 5cdf299

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,83 @@ jobs:
8181
name: ${{ env.ARTIFACT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}
8282
path: ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz
8383

84+
notarize-macos:
85+
name: notarize (macOS, 64bit)
86+
runs-on: macos-latest
87+
needs: build
88+
permissions:
89+
contents: read
90+
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v4
94+
95+
- name: Set up temporary directory for notarization
96+
run: mkdir -p ${{ env.DIST_DIR }}/notarize_temp
97+
98+
- name: Download macOS artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: ${{ env.ARTIFACT_NAME }}_macOS_64bit
102+
path: ${{ env.DIST_DIR }}/notarize_temp
103+
104+
- name: Extract macOS binary
105+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
106+
run: tar -xzvf ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz
107+
108+
- name: Import Code-Signing Certificates
109+
env:
110+
KEYCHAIN: "build.keychain"
111+
INSTALLER_CERT_MAC_PATH: "/tmp/signing_cert.p12"
112+
KEYCHAIN_PASSWORD: "keychainpassword" # Arbitrary, as it's temporary
113+
run: |
114+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
115+
security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
116+
security default-keychain -s "${{ env.KEYCHAIN }}"
117+
security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
118+
security import \
119+
"${{ env.INSTALLER_CERT_MAC_PATH }}" \
120+
-k "${{ env.KEYCHAIN }}" \
121+
-f pkcs12 \
122+
-A \
123+
-T "/usr/bin/codesign" \
124+
-P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
125+
security set-key-partition-list \
126+
-S apple-tool:,apple: \
127+
-s \
128+
-k "${{ env.KEYCHAIN_PASSWORD }}" \
129+
"${{ env.KEYCHAIN }}"
130+
131+
- name: Install gon for code signing and app notarization
132+
run: |
133+
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
134+
unzip -q gon_macos.zip -d /usr/local/bin
135+
136+
- name: Sign and notarize binary
137+
env:
138+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
139+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
140+
AC_PROVIDER: ${{ secrets.AC_PROVIDER }} # May not be needed
141+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
142+
run: |
143+
cp ../../gon.config.hcl .
144+
gon gon.config.hcl
145+
146+
- name: Re-package notarized binary
147+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
148+
run: |
149+
chmod +x qdl
150+
tar -czvf ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz qdl
151+
mv ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz ../
152+
153+
- name: Upload notarized macOS artifact
154+
uses: actions/upload-artifact@v4
155+
with:
156+
if-no-files-found: error
157+
name: ${{ env.ARTIFACT_NAME }}_macOS_64bit
158+
path: ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz
159+
overwrite: true # Important: replace the original macOS artifact
160+
84161
create-release:
85162
needs: build
86163
runs-on: ubuntu-latest

gon.config.hcl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/gon.config.hcl
2+
# See: https://github.com/Bearer/gon#configuration-file
3+
source = ["dist/qdl_macOS_64bit/bin/qdl"]
4+
bundle_id = "cc.arduino.qdl"
5+
6+
sign {
7+
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
8+
}
9+
10+
# Ask Gon for zip output to force notarization process to take place.
11+
# The CI will ignore the zip output, using the signed binary only.
12+
zip {
13+
output_path = "unused.zip"
14+
}

0 commit comments

Comments
 (0)