Skip to content

Commit e7fd828

Browse files
committed
CI: extracted notarization process for better orchestration
1 parent 17172e3 commit e7fd828

4 files changed

Lines changed: 30 additions & 12 deletions

File tree

.github/workflows/macos.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,16 @@ jobs:
4646
DEV_ID_INSTALLER: ${{ secrets.DEV_ID_INSTALLER }}
4747
DEV_ID_APPLICATION: ${{ secrets.DEV_ID_APPLICATION }}
4848
- run: .github/build.sh
49-
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'OpenSC/OpenSC' }}
5049
env:
5150
CODE_SIGN_IDENTITY: ${{ secrets.CODE_SIGN_IDENTITY }}
5251
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
5352
INSTALLER_SIGN_IDENTITY: ${{ secrets.INSTALLER_SIGN_IDENTITY }}
54-
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
55-
APPLE_ID: ${{ secrets.APPLE_ID }}
56-
- run: .github/build.sh
57-
if: ${{ ! startsWith(github.ref, 'refs/tags/') || github.repository != 'OpenSC/OpenSC' }}
53+
- run: MacOSX/notarize
54+
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'OpenSC/OpenSC' }}
5855
env:
59-
CODE_SIGN_IDENTITY: ${{ secrets.CODE_SIGN_IDENTITY }}
6056
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
61-
INSTALLER_SIGN_IDENTITY: ${{ secrets.INSTALLER_SIGN_IDENTITY }}
57+
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
58+
APPLE_ID: ${{ secrets.APPLE_ID }}
6259
- run: .github/cleanup-macos.sh
6360
env:
6461
KEY_PASSWORD: ${{ secrets.DEV_ID_PASSWORD }}

MacOSX/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ EXTRA_DIST = build \
33
build-openssl-macos.sh \
44
Distribution.xml.in \
55
libtool-bundle \
6+
notarize \
67
OpenSC_applescripts.entitlements \
78
OpenSC_binaries.entitlements \
89
OpenSC_Notify.applescript \

MacOSX/build

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ set -ex
1414
test -x ./configure || ./bootstrap
1515
BUILDPATH=${PWD}
1616

17+
# keep in sync with MacOSX/notarize
1718
while IFS='=' read -r key value; do
1819
# Skip empty or comment lines
1920
[[ -z "$key" || "$key" =~ ^# ]] && continue
2021
export "$key=$value"
2122
done < $BUILDPATH/VERSION.mk
2223

24+
# keep in sync with MacOSX/notarize
2325
export PACKAGE_VERSION=${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_FIX}
2426
PREFIX=/Library/OpenSC
2527
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig
@@ -189,8 +191,3 @@ do
189191
fi
190192
done
191193
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

MacOSX/notarize

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Notarize and staple the macOS installer image.
3+
#
4+
# This is only tested and supported on macOS 10.10 or later, using Xcode 6.0.1.
5+
# Building should also work on older macOS versions with slight changes; YMMV.
6+
7+
set -ex
8+
BUILDPATH=${PWD}
9+
10+
# keep in sync with MacOSX/build
11+
while IFS='=' read -r key value; do
12+
# Skip empty or comment lines
13+
[[ -z "$key" || "$key" =~ ^# ]] && continue
14+
export "$key=$value"
15+
done < $BUILDPATH/VERSION.mk
16+
17+
# keep in sync with MacOSX/build
18+
export PACKAGE_VERSION=${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_FIX}
19+
20+
if test -n "${NOTARIZATION_PASSWORD}" -a -n "${DEVELOPMENT_TEAM}"; then
21+
xcrun notarytool submit --team-id ${DEVELOPMENT_TEAM} --apple-id ${APPLE_ID} --password ${NOTARIZATION_PASSWORD} --wait OpenSC-${PACKAGE_VERSION}.dmg
22+
xcrun stapler staple OpenSC-${PACKAGE_VERSION}.dmg
23+
fi

0 commit comments

Comments
 (0)