Skip to content

Commit da74a19

Browse files
authored
Update macOSBuild.yml
1 parent 0738e95 commit da74a19

File tree

1 file changed

+127
-15
lines changed

1 file changed

+127
-15
lines changed

.github/workflows/macOSBuild.yml

Lines changed: 127 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: MacOS Build
1414
strategy:
1515
matrix:
16-
os: [macos-12, macos-13]
16+
os: [macos-13]
1717

1818
runs-on: ${{ matrix.os }}
1919

@@ -32,11 +32,31 @@ jobs:
3232
brew install brotli
3333
brew install icu4c
3434
brew install pkg-config
35+
brew install automake
36+
brew install autoconf
37+
brew install libtool
38+
brew install libusb-compat
39+
3540
- name: Checkout Code
3641
uses: actions/checkout@v4
3742
with:
3843
fetch-depth: 0
3944
submodules: recursive
45+
- name: Checkout Code
46+
uses: actions/checkout@v4
47+
with:
48+
repository: hamlib/hamlib
49+
path: ./hamlib
50+
ref: Hamlib-4.6
51+
52+
- name: Configure and compile
53+
run: |
54+
cd ./hamlib
55+
./bootstrap
56+
./configure --prefix=/Users/runner/work/QLog/QLog/hamlib
57+
make -j 4
58+
make check
59+
make install
4060
- name: Get version from tag
4161
run : |
4262
TAGVERSION=$(git describe --tags)
@@ -46,26 +66,118 @@ jobs:
4666
run: |
4767
mkdir build
4868
cd build
49-
qmake -config release ..
69+
qmake "HAMLIBINCLUDEPATH = /Users/runner/work/QLog/QLog/hamlib/include" "HAMLIBLIBPATH = /Users/runner/work/QLog/QLog/hamlib/lib" "HAMLIBVERSION_MAJOR = 4" "HAMLIBVERSION_MINOR = 6" "HAMLIBVERSION_PATCH = 0" -config release ..
5070
make -j4
5171
- name: Build dmg
5272
run: |
5373
cd build
54-
macdeployqt qlog.app -executable=./qlog.app/Contents/MacOS/qlog
55-
cp `brew --prefix`/lib/libhamlib.dylib qlog.app/Contents/Frameworks/libhamlib.dylib
56-
cp `brew --prefix`/lib/libqt6keychain.dylib qlog.app/Contents/Frameworks/libqt6keychain.dylib
57-
cp `brew --prefix`/lib/libdbus-1.dylib qlog.app/Contents/Frameworks/libdbus-1.dylib
58-
cp `brew --prefix brotli`/lib/libbrotlicommon.1.dylib qlog.app/Contents/Frameworks/libbrotlicommon.1.dylib
59-
cp `brew --prefix`/opt/icu4c/lib/libicui18n.74.dylib qlog.app/Contents/Frameworks/libicui18n.74.dylib
60-
install_name_tool -change `brew --prefix`/lib/libhamlib.dylib @executable_path/../Frameworks/libhamlib.dylib qlog.app/Contents/MacOS/qlog
61-
install_name_tool -change `brew --prefix`/lib/libqt6keychain.dylib @executable_path/../Frameworks/libqt6keychain.dylib qlog.app/Contents/MacOS/qlog
62-
install_name_tool -change @loader_path/libbrotlicommon.1.dylib @executable_path/../Frameworks/libbrotlicommon.1.dylib qlog.app/Contents/MacOS/qlog
63-
install_name_tool -change /usr/local/opt/icu4c/lib/libicui18n.74.dylib @executable_path/../Frameworks/libicui18n.74.dylib qlog.app/Contents/MacOS/qlog
64-
otool -L qlog.app/Contents/MacOS/qlog
65-
macdeployqt qlog.app -dmg
74+
macdeployqt qlog.app -executable=./qlog.app/Contents/MacOS/qlog
75+
macdeployqt qlog.app
76+
- name: Codesign app bundle
77+
# Extract the secrets we defined earlier as environment variables
78+
env:
79+
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
80+
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
81+
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
82+
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
83+
run: |
84+
# Turn our base64-encoded certificate back to a regular .p12 file
85+
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
86+
# We need to create a new keychain, otherwise using the certificate will prompt
87+
# with a UI dialog asking for the certificate password, which we can't
88+
# use in a headless CI environment
89+
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
90+
security default-keychain -s build.keychain
91+
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
92+
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
93+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
94+
# We finally codesign our app bundle, specifying the Hardened runtime option
95+
sudo codesign --deep --force --verify --verbose --sign "$MACOS_CERTIFICATE_NAME" --options runtime /Users/runner/work/QLog/QLog/build/qlog.app
96+
sudo codesign --force --verify --verbose --sign "$MACOS_CERTIFICATE_NAME" --entitlements /Users/runner/work/QLog/QLog/entitlements.xml --options runtime /Users/runner/work/QLog/QLog/build/qlog.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
97+
sudo codesign --force --verify --verbose --sign "$MACOS_CERTIFICATE_NAME" --options runtime /Users/runner/work/QLog/QLog/build/qlog.app/Contents/MacOS/qlog
98+
- name: "Notarize app bundle"
99+
# Extract the secrets we defined earlier as environment variables
100+
env:
101+
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
102+
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
103+
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
104+
run: |
105+
# Store the notarization credentials so that we can prevent a UI password dialog
106+
# from blocking the CI
107+
108+
echo "Create keychain profile"
109+
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
110+
111+
echo "Creating temp notarization archive"
112+
ditto -c -k --keepParent "/Users/runner/work/QLog/QLog/build/qlog.app" "notarization.zip"
113+
114+
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
115+
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
116+
# characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
117+
# you're curious
118+
119+
echo "Notarize app"
120+
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
121+
122+
echo "Attach staple"
123+
xcrun stapler staple "/Users/runner/work/QLog/QLog/build/qlog.app"
124+
- name: make dmg
125+
run: |
126+
mkdir out
127+
cp -R "/Users/runner/work/QLog/QLog/build/qlog.app" out
128+
cd out
129+
ln -s /Applications/ Applications
130+
cd ..
131+
hdiutil create -volname "QLog Installer" -srcfolder out -ov -format UDZO "/Users/runner/work/QLog/QLog/build/qlog.dmg"
132+
- name: Codesign dmg bundle
133+
# Extract the secrets we defined earlier as environment variables
134+
env:
135+
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
136+
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
137+
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
138+
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
139+
run: |
140+
# Turn our base64-encoded certificate back to a regular .p12 file
141+
##echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
142+
# We need to create a new keychain, otherwise using the certificate will prompt
143+
# with a UI dialog asking for the certificate password, which we can't
144+
# use in a headless CI environment
145+
##security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
146+
##security default-keychain -s build.keychain
147+
##security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
148+
##security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
149+
##security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
150+
# We finally codesign our app bundle, specifying the Hardened runtime option
151+
/usr/bin/codesign --timestamp -s "$MACOS_CERTIFICATE_NAME" --options runtime --deep -f /Users/runner/work/QLog/QLog/build/qlog.dmg
152+
- name: "Notarize app bundle"
153+
# Extract the secrets we defined earlier as environment variables
154+
env:
155+
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
156+
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
157+
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
158+
run: |
159+
# Store the notarization credentials so that we can prevent a UI password dialog
160+
# from blocking the CI
161+
162+
echo "Create keychain profile"
163+
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
164+
165+
echo "Creating temp notarization archive"
166+
ditto -c -k --keepParent "/Users/runner/work/QLog/QLog/build/qlog.dmg" "notarization.zip"
167+
168+
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
169+
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
170+
# characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
171+
# you're curious
172+
173+
echo "Notarize app"
174+
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
175+
176+
echo "Attach staple"
177+
xcrun stapler staple "/Users/runner/work/QLog/QLog/build/qlog.dmg"
178+
66179
- name: Copy artifact
67180
uses: actions/upload-artifact@v4
68181
with:
69182
name: QLog-${{ env.TAGVERSION }}-${{ matrix.os }}
70183
path: /Users/runner/work/QLog/QLog/build/qlog.dmg
71-

0 commit comments

Comments
 (0)