@@ -33,26 +33,21 @@ jobs:
3333 LAZ_OPT :
3434 - os : macos-latest
3535 LAZBUILD_WITH_PATH : /Applications/Lazarus/lazbuild
36- RELEASE_ZIP_FILE : trackereditor_UNSIGNED_macOS_Intel_64 .zip
36+ RELEASE_ZIP_FILE : trackereditor_macOS_amd64 .zip
3737 LAZ_OPT : --widgetset=cocoa
3838
3939 steps :
4040 - uses : actions/checkout@v4
4141
42- - name : show LAZBUILD_WITH_PATH (deprecated)
43- if : ${{ matrix.LAZBUILD_WITH_PATH }}
44- shell : bash
45- run : echo ${{ matrix.LAZBUILD_WITH_PATH }}
46-
4742 - name : Install Lazarus IDE
4843 run : |
4944 if [ "$RUNNER_OS" == "Linux" ]; then
5045 sudo apt install -y lazarus zip
5146 elif [ "$RUNNER_OS" == "Windows" ]; then
5247 choco install lazarus zip
5348 # 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
5651 elif [ "$RUNNER_OS" == "macOS" ]; then
5752 brew install --cask lazarus
5853 else
@@ -98,27 +93,103 @@ jobs:
9893 zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor.exe enduser/*.dll
9994 shell : bash
10095
101- - name : Create a zip file for macOS .app release. (unsigned macOS app)
96+ - name : Move file into macOS .app
10297 if : matrix.os == 'macos-latest'
10398 run : |
10499 # copy everything into enduser/macos/app folder
105100 #
106101 # Move the executable to the application bundle
107102 mv enduser/trackereditor enduser/macos/app/trackereditor.app/Contents/MacOS
103+
108104 # Move the trackers list to application bundle
109105 mv enduser/add_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
110106 mv enduser/remove_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
107+
111108 # move all the *.txt file
112109 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+
113183 # zip only the app folder with extra text file.
184+ echo "Zip file"
114185 /usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}"
115186 shell : bash
116187
117188 - name : Upload Artifact
118189 uses : actions/upload-artifact@v3
119190 with :
120191 path : ${{ matrix.RELEASE_ZIP_FILE }}
121- if-no-files-found : error # 'warn'. error
192+ if-no-files-found : error
122193
123194 - name : Zip file release to end user
124195 uses : softprops/action-gh-release@v1
0 commit comments