@@ -33,26 +33,21 @@ jobs:
33
33
LAZ_OPT :
34
34
- os : macos-latest
35
35
LAZBUILD_WITH_PATH : /Applications/Lazarus/lazbuild
36
- RELEASE_ZIP_FILE : trackereditor_UNSIGNED_macOS_Intel_64 .zip
36
+ RELEASE_ZIP_FILE : trackereditor_macOS_amd64 .zip
37
37
LAZ_OPT : --widgetset=cocoa
38
38
39
39
steps :
40
40
- uses : actions/checkout@v4
41
41
42
- - name : show LAZBUILD_WITH_PATH (deprecated)
43
- if : ${{ matrix.LAZBUILD_WITH_PATH }}
44
- shell : bash
45
- run : echo ${{ matrix.LAZBUILD_WITH_PATH }}
46
-
47
42
- name : Install Lazarus IDE
48
43
run : |
49
44
if [ "$RUNNER_OS" == "Linux" ]; then
50
45
sudo apt install -y lazarus zip
51
46
elif [ "$RUNNER_OS" == "Windows" ]; then
52
47
choco install lazarus zip
53
48
# https://wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries
54
- curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/Renesas-RX-GCC /releases/latest/ download/libssl-3-x64.dll
55
- curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/Renesas-RX-GCC /releases/latest/ download/libcrypto-3-x64.dll
49
+ curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor /releases/download/V1.32.0 /libssl-3-x64.dll
50
+ curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor /releases/download/V1.32.0 /libcrypto-3-x64.dll
56
51
elif [ "$RUNNER_OS" == "macOS" ]; then
57
52
brew install --cask lazarus
58
53
else
@@ -98,27 +93,103 @@ jobs:
98
93
zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor.exe enduser/*.dll
99
94
shell : bash
100
95
101
- - name : Create a zip file for macOS .app release. (unsigned macOS app)
96
+ - name : Move file into macOS .app
102
97
if : matrix.os == 'macos-latest'
103
98
run : |
104
99
# copy everything into enduser/macos/app folder
105
100
#
106
101
# Move the executable to the application bundle
107
102
mv enduser/trackereditor enduser/macos/app/trackereditor.app/Contents/MacOS
103
+
108
104
# Move the trackers list to application bundle
109
105
mv enduser/add_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
110
106
mv enduser/remove_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
107
+
111
108
# move all the *.txt file
112
109
mv enduser/*.txt enduser/macos/app
110
+
111
+ # zip only the app folder with extra text file.
112
+ # /usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}"
113
+ shell : bash
114
+
115
+ - name : Codesign macOS app bundle
116
+ # This macOS Codesign step is copied from:
117
+ # https://federicoterzi.com/blog/automatic-code-signing-and-notarization-for-macos-apps-using-github-actions/
118
+ # This is a bit different from the previous version for Travis-CI build system to build bittorrent tracker editor
119
+ if : matrix.os == 'macos-latest'
120
+ env :
121
+ MACOS_CERTIFICATE : ${{ secrets.PROD_MACOS_CERTIFICATE }}
122
+ MACOS_CERTIFICATE_PWD : ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
123
+ MACOS_CERTIFICATE_NAME : ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
124
+ MACOS_CI_KEYCHAIN_PWD : ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
125
+ run : |
126
+ # Turn our base64-encoded certificate back to a regular .p12 file
127
+ echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
128
+
129
+ # We need to create a new keychain, otherwise using the certificate will prompt
130
+ # with a UI dialog asking for the certificate password, which we can't
131
+ # use in a headless CI environment
132
+
133
+ security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
134
+ security default-keychain -s build.keychain
135
+ security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
136
+ security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
137
+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
138
+
139
+ # We finally codesign our app bundle, specifying the Hardened runtime option.
140
+ #/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime enduser/macos/app/trackereditor.app -v
141
+
142
+ # sign the app. -sign is the developer cetificate ID
143
+ # entitlements does not work at this moment
144
+ #codesign --timestamp --entitlements enduser/macos/entitlements.plist --force --options runtime --deep --sign $CERTIFICATE_ID $FILE_APP
145
+
146
+ # Please note: this is the same code version used in Travis-CI
147
+ /usr/bin/codesign --timestamp --force --options runtime --deep --sign "$MACOS_CERTIFICATE_NAME" enduser/macos/app/trackereditor.app
148
+ shell : bash
149
+
150
+ - name : Notarize macOS app bundle
151
+ if : matrix.os == 'macos-latest'
152
+ env :
153
+ PROD_MACOS_NOTARIZATION_APPLE_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
154
+ PROD_MACOS_NOTARIZATION_TEAM_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
155
+ PROD_MACOS_NOTARIZATION_PWD : ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
156
+ run : |
157
+ # Store the notarization credentials so that we can prevent a UI password dialog
158
+ # from blocking the CI
159
+
160
+ echo "Create keychain profile"
161
+ 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"
162
+
163
+ # We can't notarize an app bundle directly, but we need to compress it as an archive.
164
+ # Therefore, we create a zip file containing our app bundle, so that we can send it to the
165
+ # notarization service
166
+
167
+ echo "Creating temp notarization archive"
168
+ ditto -c -k --keepParent "enduser/macos/app/trackereditor.app" "notarization.zip"
169
+
170
+ # Here we send the notarization request to the Apple's Notarization service, waiting for the result.
171
+ # This typically takes a few seconds inside a CI environment, but it might take more depending on the App
172
+ # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
173
+ # you're curious
174
+
175
+ echo "Notarize app"
176
+ xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
177
+
178
+ # Finally, we need to "attach the staple" to our executable, which will allow our app to be
179
+ # validated by macOS even when an internet connection is not available.
180
+ echo "Attach staple"
181
+ xcrun stapler staple "enduser/macos/app/trackereditor.app"
182
+
113
183
# zip only the app folder with extra text file.
184
+ echo "Zip file"
114
185
/usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}"
115
186
shell : bash
116
187
117
188
- name : Upload Artifact
118
189
uses : actions/upload-artifact@v3
119
190
with :
120
191
path : ${{ matrix.RELEASE_ZIP_FILE }}
121
- if-no-files-found : error # 'warn'. error
192
+ if-no-files-found : error
122
193
123
194
- name : Zip file release to end user
124
195
uses : softprops/action-gh-release@v1
0 commit comments