-
-
Notifications
You must be signed in to change notification settings - Fork 2
378 lines (314 loc) · 17.4 KB
/
release_github.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
name: release_github
on:
workflow_dispatch:
inputs:
release:
description: 'Release after build'
required: true
default: 'no'
jobs:
build:
runs-on: macos-15
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: List Xcode Installations
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Change to Xcode Project Directory
run: cd Source/Marker\ Data
- name: Install node-appdmg
run: npm install -g appdmg
- name: Create Distribution Directory
run: mkdir -p dist/dmg-builds
- name: Prepare Directories
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
mkdir -p "$PARENT/dist/dmg-builds/sparkle"
mkdir -p "$PARENT/dist/dmg-builds/latest-build"
mkdir -p "$PARENT/dist/dmg-builds/app-build"
mkdir -p "$PARENT/dist/dmg-builds/sdk"
- name: Copy Local Distribution
run: |
mkdir -p dist/dmg-builds
mkdir -p dist/dmg-builds/latest-build
cp -R ./Distribution/dmg-builds/. ./dist/dmg-builds
- name: Verify Copied Files
run: |
echo "Checking copied files..."
ls -l ./dist/dmg-builds
ls -l ./dist/dmg-builds/latest-build
ls -l ./dist/dmg-builds/uninstaller/include
- name: Create Distribution Directory
run: mkdir -p dist/dmg-builds/dmg-output
- name: Verify Copied Files
run: |
echo "Checking copied files..."
ls -l ./dist/dmg-builds/dmg-output
- name: Copy Workflow Extensions SDK
run: |
mkdir -p dist/dmg-builds/sdk
cp -R ./SDK/Workflow_Extensions_1.0.3.dmg ./dist/dmg-builds/sdk
- name: Mount Workflow Extensions DMG
run: |
hdiutil attach ./dist/dmg-builds/sdk/Workflow_Extensions_1.0.3.dmg
- name: Install Workflow Extensions SDK
run: |
sudo installer -pkg /Volumes/WorkflowExtensionsSDK/WorkflowExtensionsSDK.pkg -target /
- name: View Volume Directory
run: |
ls /Volumes
- name: View Workflow Extensions SDK DMG Directory
run: |
ls /Volumes/WorkflowExtensionsSDK
- name: Unmount Workflow Extensions SDK DMG
run: |
hdiutil detach /Volumes/WorkflowExtensionsSDK
- name: Check Installed Workflow Extensions SDK Directory
run: |
ls /Library/Developer/SDKs
- name: Build Marker Data
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
PROJECT_PATH="Source/Marker Data/Marker Data.xcodeproj"
SCHEME="Marker Data"
CONFIGURATION="Release"
DESTINATION="platform=macOS,arch=arm64"
BUILD_FOLDER="$PARENT/dist/dmg-builds/app-build"
echo "PARENT=$PARENT" >> $GITHUB_ENV
echo "CONFIG=$CONFIGURATION" >> $GITHUB_ENV
xcodebuild -project "$PROJECT_PATH" -scheme "$SCHEME" -configuration "$CONFIGURATION" -destination "$DESTINATION" -derivedDataPath "$BUILD_FOLDER" clean build ONLY_ACTIVE_ARCH=NO EXCLUDED_ARCHS="x86_64" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -allowProvisioningUpdates | xcpretty
- name: Prepare VM Directories
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
mkdir -p "$PARENT/dist/dmg-builds"
mkdir -p "$PARENT/dist/dmg-builds/sparkle"
mkdir -p "$PARENT/dist/dmg-builds/latest-build"
mkdir -p "$PARENT/dist/dmg-builds/dmg-output"
mkdir -p "$PARENT/dist/dmg-builds/uninstaller/include"
cp -R ./Distribution/dmg-builds/entitlements.plist "$PARENT/dist/dmg-builds/"
cp -R ./Distribution/dmg-builds/uninstaller/include/applet.icns "$PARENT/dist/dmg-builds/uninstaller/include/"
cp -R ./Distribution/dmg-builds/uninstaller/include/entitlements.plist "$PARENT/dist/dmg-builds/uninstaller/include/"
cp -R ./Distribution/dmg-builds/uninstaller/include/Uninstall\ Marker\ Data.scpt "$PARENT/dist/dmg-builds/uninstaller/include/"
cp -R ./Distribution/dmg-builds/build-marker-data-dmg.json "$PARENT/dist/dmg-builds/"
cp -R $PARENT/dist/dmg-builds/app-build/Build/Products/${{ env.CONFIG }}/Marker\ Data.app "$PARENT/dist/dmg-builds/latest-build/"
cp -R ./Distribution/dmg-builds/dmg-background.png "$PARENT/dist/dmg-builds/"
cp -R ./Distribution/dmg-builds/[email protected] "$PARENT/dist/dmg-builds/"
cp -R ./Distribution/dmg-builds/marker-data-dmg-icon.icns "$PARENT/dist/dmg-builds/"
cp -R ./Distribution/dmg-builds/sparkle/sign_update "$PARENT/dist/dmg-builds/sparkle/"
- name: Codesign Marker Data Workflow Extension
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
KEYCHAIN_PASSWORD_MX: ${{ secrets.KEYCHAIN_PASSWORD_MX }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
ENTITLE="$PARENT/dist/dmg-builds/entitlements.plist"
APPX="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/PlugIns/Workflow Extension.appex"
echo $APPLE_CERT_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD_MX build-mx.keychain
security default-keychain -s build-mx.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD_MX build-mx.keychain
security import certificate.p12 -k build-mx.keychain -P $APPLE_CERT_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD_MX build-mx.keychain
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime --entitlements "$ENTITLE" "$APPX" -v
- name: Codesign Marker Data Sparkle Framework
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
KEYCHAIN_PASSWORD_SF: ${{ secrets.KEYCHAIN_PASSWORD_SF }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
APPSF1="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Installer.xpc"
APPSF2="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc"
APPSF3="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate"
APPSF4="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app"
APPSF5="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Frameworks/Sparkle.framework"
echo $APPLE_CERT_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD_SF build-sf.keychain
security default-keychain -s build-sf.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD_SF build-sf.keychain
security import certificate.p12 -k build-sf.keychain -P $APPLE_CERT_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD_SF build-sf.keychain
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APPSF1" -v
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APPSF2" -v
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APPSF3" -v
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APPSF4" -v
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APPSF5" -v
- name: Codesign Marker Data
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
KEYCHAIN_PASSWORD_M: ${{ secrets.KEYCHAIN_PASSWORD_M }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
APP="$PARENT/dist/dmg-builds/latest-build/Marker Data.app"
echo $APPLE_CERT_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD_M build-m.keychain
security default-keychain -s build-m.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD_M build-m.keychain
security import certificate.p12 -k build-m.keychain -P $APPLE_CERT_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD_M build-m.keychain
/usr/bin/codesign --force -s $APPLE_TEAM_ID --options runtime "$APP" -v
- name: Notarize Marker Data
env:
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
APPLE_DEV_ID_PASSWORD: ${{ secrets.APPLE_DEV_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
APP="$PARENT/dist/dmg-builds/latest-build/Marker Data.app"
echo "Create keychain profile"
xcrun notarytool store-credentials "notarytool-profile" --apple-id $APPLE_DEV_ID --password $APPLE_DEV_ID_PASSWORD --team-id $APPLE_TEAM_ID
echo "Creating temp notarization archive"
ditto -c -k --keepParent "$APP" "notarization-m.zip"
echo "Notarize app"
xcrun notarytool submit "notarization-m.zip" --keychain-profile "notarytool-profile" --progress --wait
echo "Attach staple"
xcrun stapler staple "$APP"
- name: Build Uninstaller
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
UAPP="$PARENT/dist/dmg-builds/latest-build/Uninstall Marker Data.app"
SCRIPT="$PARENT/dist/dmg-builds/uninstaller/include/Uninstall Marker Data.scpt"
ENTITLE="$PARENT/dist/dmg-builds/uninstaller/include/entitlements.plist"
ICON="$PARENT/dist/dmg-builds/uninstaller/include/applet.icns"
rm -rf "$UAPP"
osacompile -x -o "$UAPP" "$SCRIPT"
cp "$ICON" "$UAPP"/Contents/Resources/applet.icns
xattr -cr "$UAPP"
- name: Verify Uninstaller
run: |
echo "Checking copied files..."
ls -l ./dist/dmg-builds/latest-build
- name: Codesign Uninstaller
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
KEYCHAIN_PASSWORD_U: ${{ secrets.KEYCHAIN_PASSWORD_U }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
ENTITLE="$PARENT/dist/dmg-builds/uninstaller/include/entitlements.plist"
UAPP="$PARENT/dist/dmg-builds/latest-build/Uninstall Marker Data.app"
echo $APPLE_CERT_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD_U build-u.keychain
security default-keychain -s build-u.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD_U build-u.keychain
security import certificate.p12 -k build-u.keychain -P $APPLE_CERT_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD_U build-u.keychain
/usr/bin/codesign --force -s $APPLE_TEAM_ID --identifier "co.theacharya.MarkerData.Uninstaller" --options runtime --entitlements "$ENTITLE" "$UAPP" -v
- name: Notarize Uninstaller
env:
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
APPLE_DEV_ID_PASSWORD: ${{ secrets.APPLE_DEV_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
UAPP="$PARENT/dist/dmg-builds/latest-build/Uninstall Marker Data.app"
echo "Create keychain profile"
xcrun notarytool store-credentials "notarytool-profile" --apple-id $APPLE_DEV_ID --password $APPLE_DEV_ID_PASSWORD --team-id $APPLE_TEAM_ID
echo "Creating temp notarization archive"
ditto -c -k --keepParent "$UAPP" "notarization-u.zip"
echo "Notarize app"
xcrun notarytool submit "notarization-u.zip" --keychain-profile "notarytool-profile" --progress --wait
echo "Attach staple"
xcrun stapler staple "$UAPP"
- name: Build DMG
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
VER=$(cat ./Distribution/version.txt)
JSON="$PARENT/dist/dmg-builds/build-marker-data-dmg.json"
OUTPUT="$PARENT/dist/dmg-builds/dmg-output/Marker-Data_"
appdmg "$JSON" "$OUTPUT""$VER.dmg"
- name: Verify DMG
run: |
echo "Checking copied files..."
ls -l ./dist/dmg-builds/dmg-output
- name: Codesign DMG
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
KEYCHAIN_PASSWORD_D: ${{ secrets.KEYCHAIN_PASSWORD_D }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
VER=$(cat ./Distribution/version.txt)
DMG="$PARENT/dist/dmg-builds/dmg-output/Marker-Data_"
echo $APPLE_CERT_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD_D build-d.keychain
security default-keychain -s build-d.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD_D build-d.keychain
security import certificate.p12 -k build-d.keychain -P $APPLE_CERT_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD_D build-d.keychain
/usr/bin/codesign --force -s $APPLE_TEAM_ID --identifier "Marker Data Installer" --options runtime "$DMG""$VER.dmg" -v
- name: Notarize DMG
env:
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
APPLE_DEV_ID_PASSWORD: ${{ secrets.APPLE_DEV_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
VER=$(cat ./Distribution/version.txt)
DMG="$PARENT/dist/dmg-builds/dmg-output/Marker-Data_"
echo "Create keychain profile"
xcrun notarytool store-credentials "notarytool-profile" --apple-id $APPLE_DEV_ID --password $APPLE_DEV_ID_PASSWORD --team-id $APPLE_TEAM_ID
echo "Notarize DMG"
xcrun notarytool submit "$DMG""$VER.dmg" --keychain-profile "notarytool-profile" --progress --wait
echo "Attach staple"
xcrun stapler staple "$DMG""$VER.dmg"
- name: Prepare Sparkle Key
env:
PRIVATE_SPARKLE_KEY: ${{ secrets.PRIVATE_SPARKLE_KEY }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
echo -n "$PRIVATE_SPARKLE_KEY" > "$PARENT/dist/dmg-builds/sparkle/sparkle_private_key"
- name: Sparkle Sign DMG & Generate Appcast
env:
PRIVATE_SPARKLE_KEY: ${{ secrets.PRIVATE_SPARKLE_KEY }}
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
TOOL_PATH="$PARENT/dist/dmg-builds/sparkle/sign_update"
ED_KEY="$PARENT/dist/dmg-builds/sparkle/sparkle_private_key"
VER=$(cat ./Distribution/version.txt)
APP_INFO="$PARENT/dist/dmg-builds/latest-build/Marker Data.app/Contents/Info.plist"
DMG="$PARENT/dist/dmg-builds/dmg-output/Marker-Data_"
echo "Create & Print Sparkle EdDSA Signature"
"$TOOL_PATH" "$DMG""$VER.dmg" --ed-key-file "$ED_KEY" | tee "$PARENT/dist/dmg-builds/latest-build/EdDSA.txt"
EDSA=$(sudo cat "$PARENT/dist/dmg-builds/latest-build/EdDSA.txt")
echo "Read & Print Bundle Version"
/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$APP_INFO" | tee "$PARENT/dist/dmg-builds/latest-build/ShortVersionString.txt"
BUNDLE_VERSION=$(sudo cat "$PARENT/dist/dmg-builds/latest-build/ShortVersionString.txt")
echo "Read & Print Bundle Build"
/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$APP_INFO" | tee "$PARENT/dist/dmg-builds/latest-build/BundleVersion.txt"
BUNDLE_BUILD=$(sudo cat "$PARENT/dist/dmg-builds/latest-build/BundleVersion.txt")
python3 Distribution/dmg-builds/sparkle/generate_appcast_script.py "$BUNDLE_VERSION" "$BUNDLE_BUILD" "$EDSA"
git config user.email "[email protected]"
git config user.name "GitHub Actions"
git add ./appcast.xml
git commit -m "Marker Data $BUNDLE_VERSION Released"
git push
- name: Create Environment Files
run: |
PARENT=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
VER=$(cat ./Distribution/version.txt)
echo "PARENT=$PARENT" >> $GITHUB_ENV
echo "VER=$VER" >> $GITHUB_ENV
- name: Save DMG as Artifact
uses: actions/upload-artifact@v4
with:
name: marker-data-dmg
path: ${{ env.PARENT }}/dist/dmg-builds/dmg-output/Marker-Data_${{ env.VER }}.dmg
- name: Release Github
if: ${{ github.event.inputs.release == 'yes' }}
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.PARENT }}/dist/dmg-builds/dmg-output/Marker-Data_${{ env.VER }}.dmg"
token: ${{ secrets.GITHUB_TOKEN }}
name: Marker Data ${{ env.VER }}
tag: ${{ env.VER }}
draft: true