Skip to content

Commit 647421d

Browse files
committed
macOS code signing
Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 24869e7 commit 647421d

7 files changed

Lines changed: 25 additions & 21 deletions

File tree

.github/add_signing_key.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
set -ex -o xtrace
44

55
pushd .github/
6-
tar xvf secrets.tar
76
KEY_CHAIN=mac-build.keychain
87

98
# Create the keychain with a password
@@ -21,13 +20,10 @@ curl -L https://developer.apple.com/certificationauthority/AppleWWDRCA.cer > App
2120
security import AppleWWDRCA.cer \
2221
-k ~/Library/Keychains/$KEY_CHAIN \
2322
-T /usr/bin/codesign -T /usr/bin/productsign
24-
security import DeveloperIDApplication.cer \
25-
-k ~/Library/Keychains/$KEY_CHAIN \
26-
-T /usr/bin/codesign -T /usr/bin/productsign
27-
security import DeveloperIDInstaller.cer \
28-
-k ~/Library/Keychains/$KEY_CHAIN \
23+
security import DeveloperIDApplication.p12 \
24+
-k ~/Library/Keychains/$KEY_CHAIN -P $KEY_PASSWORD \
2925
-T /usr/bin/codesign -T /usr/bin/productsign
30-
security import key.p12 \
26+
security import DeveloperIDInstaller.p12 \
3127
-k ~/Library/Keychains/$KEY_CHAIN -P $KEY_PASSWORD \
3228
-T /usr/bin/codesign -T /usr/bin/productsign
3329
security unlock-keychain -p travis $KEY_CHAIN

.github/cleanup-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
set -ex -o xtrace
44

5-
if [ -n "$PASS_SECRETS_TAR_ENC" ]; then
5+
if [ -n "$KEY_PASSWORD" ]; then
66
.github/remove_signing_key.sh
77
fi

.github/remove_signing_key.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set -ex -o xtrace
44

55
pushd .github/
66
security delete-keychain mac-build.keychain
7-
rm -f DeveloperIDApplication.cer DeveloperIDInstaller.cer key.p12
7+
rm -f DeveloperIDApplication.p12 DeveloperIDInstaller.p12
88
popd

.github/secrets.tar.gpg

-5.15 KB
Binary file not shown.

.github/setup-macos.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ fi
1111
export PATH="/usr/local/opt/ccache/libexec:$PATH"
1212
git clone https://github.com/frankmorgner/OpenSCToken.git
1313

14-
if [ -n "$PASS_SECRETS_TAR_ENC" ]; then
15-
gpg --quiet --batch --yes --decrypt --passphrase="$PASS_SECRETS_TAR_ENC" --output .github/secrets.tar .github/secrets.tar.gpg
14+
if [ -n "$KEY_PASSWORD" ]; then
15+
echo $DEV_ID_APPLICATION | base64 --decode > .github/DeveloperIDApplication.p12
16+
echo $DEV_ID_INSTALLER | base64 --decode > .github/DeveloperIDInstaller.p12
1617
.github/add_signing_key.sh;
1718
else
1819
unset CODE_SIGN_IDENTITY INSTALLER_SIGN_IDENTITY;

.github/workflows/macos.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ jobs:
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- uses: actions/checkout@v5
27-
- run: .github/setup-macos.sh
28-
env:
29-
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
30-
PASS_SECRETS_TAR_ENC: ${{ secrets.PASS_SECRETS_TAR_ENC }}
3127
- name: Checkout OpenSSL sources
3228
uses: actions/checkout@v5
3329
with:
@@ -44,23 +40,29 @@ jobs:
4440
key: ${{ matrix.os }}-OpenSSL-${{ steps.openssl_hash.outputs.hash }}
4541
- run: sh MacOSX/build-openssl-macos.sh
4642
if: steps.cache.outputs.cache-hit != 'true'
43+
- run: .github/setup-macos.sh
44+
env:
45+
KEY_PASSWORD: ${{ secrets.DEV_ID_PASSWORD }}
46+
DEV_ID_INSTALLER: ${{ secrets.DEV_ID_INSTALLER }}
47+
DEV_ID_APPLICATION: ${{ secrets.DEV_ID_APPLICATION }}
4748
- run: .github/build.sh
4849
env:
4950
CODE_SIGN_IDENTITY: ${{ secrets.CODE_SIGN_IDENTITY }}
5051
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
5152
INSTALLER_SIGN_IDENTITY: ${{ secrets.INSTALLER_SIGN_IDENTITY }}
53+
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
54+
APPLE_ID: ${{ secrets.APPLE_ID }}
55+
- run: .github/cleanup-macos.sh
56+
env:
57+
KEY_PASSWORD: ${{ secrets.DEV_ID_PASSWORD }}
5258
- name: Cache build artifacts
53-
uses: actions/upload-artifact@v4
59+
uses: actions/upload-artifact@v5
5460
with:
5561
name: opensc-build-${{ matrix.os }}
5662
path:
5763
OpenSC*.dmg
58-
- run: .github/cleanup-macos.sh
59-
env:
60-
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
61-
PASS_SECRETS_TAR_ENC: ${{ secrets.PASS_SECRETS_TAR_ENC }}
6264
- name: Upload test logs
63-
uses: actions/upload-artifact@v4
65+
uses: actions/upload-artifact@v5
6466
if: failure()
6567
with:
6668
name: ${{ matrix.os }}-logs

MacOSX/build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,8 @@ do
189189
fi
190190
done
191191
rm -rf ${imagedir}
192+
193+
if test -n "${NOTARIZATION_PASSWORD}"; then
194+
xcrun notarytool submit --team-id ${DEVELOPMENT_TEAM} --apple-id ${APPLE_ID} --password ${NOTARIZATION_PASSWORD} --wait OpenSC-${PACKAGE_VERSION}.dmg
195+
xcrun stapler staple OpenSC-${PACKAGE_VERSION}.dmg
196+
fi

0 commit comments

Comments
 (0)