17
17
env :
18
18
LAZBUILD_WITH_PATH : /Applications/Lazarus/lazbuild
19
19
RELEASE_ZIP_FILE : trackereditor_macOS_amd64.zip
20
+ MACOS_APP : enduser/trackereditor.app
20
21
LAZ_OPT : --widgetset=cocoa
22
+ BUILD_WITH_CERTIFICATE : ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
21
23
22
24
steps :
23
25
- uses : actions/checkout@v4
67
69
shell : bash
68
70
69
71
- name : Codesign macOS app bundle
72
+ if : ${{ env.BUILD_WITH_CERTIFICATE != '' }}
70
73
# This macOS Codesign step is copied from:
71
74
# https://federicoterzi.com/blog/automatic-code-signing-and-notarization-for-macos-apps-using-github-actions/
72
75
# This is a bit different from the previous version for Travis-CI build system to build bittorrent tracker editor
75
78
MACOS_CERTIFICATE_PWD : ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
76
79
MACOS_CERTIFICATE_NAME : ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
77
80
MACOS_CI_KEYCHAIN_PWD : ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
78
- MACOS_APP : enduser/trackereditor.app
79
81
run : |
80
82
# Turn our base64-encoded certificate back to a regular .p12 file
81
83
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
@@ -91,19 +93,19 @@ jobs:
91
93
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
92
94
93
95
# We finally codesign our app bundle, specifying the Hardened runtime option.
94
- #/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime "$MACOS_APP" -v
96
+ #/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime "${{ env. MACOS_APP }} " -v
95
97
96
98
# sign the app. -sign is the developer cetificate ID
97
99
# Must use --deep to sign all internal content
98
- /usr/bin/codesign --timestamp --force --options runtime --deep --sign "$MACOS_CERTIFICATE_NAME" "$MACOS_APP"
100
+ /usr/bin/codesign --timestamp --force --options runtime --deep --sign "$MACOS_CERTIFICATE_NAME" "${{ env. MACOS_APP }} "
99
101
shell : bash
100
102
101
103
- name : Notarize macOS app bundle
104
+ if : ${{ env.BUILD_WITH_CERTIFICATE != '' }}
102
105
env :
103
106
PROD_MACOS_NOTARIZATION_APPLE_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
104
107
PROD_MACOS_NOTARIZATION_TEAM_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
105
108
PROD_MACOS_NOTARIZATION_PWD : ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
106
- MACOS_APP : enduser/trackereditor.app
107
109
run : |
108
110
# Store the notarization credentials so that we can prevent a UI password dialog
109
111
# from blocking the CI
@@ -116,7 +118,7 @@ jobs:
116
118
# notarization service
117
119
118
120
echo "Creating temp notarization archive"
119
- ditto -c -k --keepParent "$MACOS_APP" "notarization.zip"
121
+ ditto -c -k --keepParent "${{ env. MACOS_APP }} " "notarization.zip"
120
122
121
123
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
122
124
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
@@ -129,14 +131,13 @@ jobs:
129
131
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
130
132
# validated by macOS even when an internet connection is not available.
131
133
echo "Attach staple"
132
- xcrun stapler staple "$MACOS_APP"
133
-
134
- # Remove notarization.zip, otherwise it will also be 'released' to the end user
135
- rm -f "notarization.zip"
134
+ xcrun stapler staple "${{ env.MACOS_APP }}"
135
+ shell : bash
136
136
137
- # zip only the app folder.
137
+ - name : Zip only the app folder.
138
+ run : |
138
139
echo "Zip macOS app file"
139
- /usr/bin/ditto -c -k --keepParent "$MACOS_APP" "${{ env.RELEASE_ZIP_FILE }}"
140
+ /usr/bin/ditto -c -k --keepParent "${{ env. MACOS_APP }} " "${{ env.RELEASE_ZIP_FILE }}"
140
141
shell : bash
141
142
142
143
- name : Upload Artifact
0 commit comments