1
- jobs :
2
- - job : main_build
3
- displayName : ' Main Build'
4
- pool :
5
- vmImage : ' macos-latest'
6
- steps :
7
- - task : Xcode@5
8
- displayName : ' Build macOS Wrapper'
9
- inputs :
10
- actions : ' build'
11
- configuration : ' Release'
12
- sdk :
13
- xcWorkspacePath : ' **/*.xcodeproj'
14
- destinationPlatformOption : ' macOS'
15
-
16
- - task : PublishBuildArtifacts@1
17
- displayName : ' Bundle Release'
18
- inputs :
19
- PathtoPublish : ' $(System.DefaultWorkingDirectory)/build/Release/'
20
- ArtifactName : ' jellyfin-macos-wrapper.zip'
21
- publishLocation : ' Container'
1
+ trigger :
2
+ - master
3
+
4
+ pool :
5
+ vmImage : ' macos-latest'
6
+
7
+ steps :
8
+
9
+ # Add all Apple signing material
10
+ - task : InstallAppleCertificate@2
11
+ inputs :
12
+ certSecureFile : ' MacAnthony2.p12'
13
+ certPwd : ' $(CertificatePassword)'
14
+ keychain : ' temp'
15
+
16
+ - task : InstallAppleProvisioningProfile@1
17
+ inputs :
18
+ provisioningProfileLocation : ' secureFiles'
19
+ provProfileSecureFile : ' JellyfinMacProvision.provisionprofile'
20
+
21
+ # Compile the .app bundle
22
+ - task : Xcode@5
23
+ inputs :
24
+ actions : ' build'
25
+ configuration : ' Release'
26
+ sdk : ' macosx10.15'
27
+ xcWorkspacePath : ' **/*.xcodeproj'
28
+ packageApp : false
29
+ signingOption : ' default'
30
+ destinationPlatformOption : ' macOS'
31
+ useXcpretty : true
32
+
33
+ # Get the latest Jellyfin release for mac
34
+ - task : DownloadGitHubRelease@0
35
+ inputs :
36
+ connection : ' Jellyfin Release Download'
37
+ userRepository : ' jellyfin/jellyfin'
38
+ defaultVersionType : ' latest'
39
+ itemPattern : ' *macos.tar.gz'
40
+ downloadPath : ' $(System.DefaultWorkingDirectory)/build/Release/'
41
+
42
+ # Extract them in to the working directory
43
+ - task : ExtractFiles@1
44
+ inputs :
45
+ archiveFilePatterns : ' *.gz'
46
+ destinationFolder : ' $(System.DefaultWorkingDirectory)/build/Release/'
47
+ cleanDestinationFolder : false
48
+
49
+ # Download FFmpeg and extract it
50
+ - task : Bash@3
51
+ inputs :
52
+ targetType : ' inline'
53
+ script : ' curl https://www.zeranoe.com/builds/macos64/static/ffmpeg-4.2.3-macos64-static.zip -o ffmpeg.zip'
54
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/build/Release/'
55
+ - task : ExtractFiles@1
56
+ inputs :
57
+ archiveFilePatterns : ' $(System.DefaultWorkingDirectory)/build/Release/ffmpeg.zip'
58
+ destinationFolder : ' $(System.DefaultWorkingDirectory)/build/Release/'
59
+ cleanDestinationFolder : false
60
+
61
+ - task : Bash@3
62
+ inputs :
63
+ targetType : ' inline'
64
+ script : |
65
+ # Rename the bundle
66
+ echo "[INFO] Renaming Jellyfin Server.app as Jellyfin.app..."
67
+ mv "Jellyfin Server.app" "Jellyfin.app"
68
+
69
+ # Read the extracted Jellyfin binary folder name, get version
70
+ echo "[INFO] Reading details from Jellyfin release..."
71
+ dir_name="$( find . -type d -name "jellyfin_*" -exec basename {} \; )"
72
+ version="$(awk -F'_' '{ print $NF }' <<<"${dir_name}")"
73
+
74
+ # Update the version number in the plist to be accurate
75
+ echo "[INFO] Updating .plist for version $version"
76
+ plutil -replace CFBundleVersion -string "$version" "Jellyfin.app/Contents/Info.plist"
77
+
78
+ # Copy FFmpeg in to the correct folder
79
+ echo "[INFO] Copying FFmpeg into server folder..."
80
+ cp ffmpeg*/bin/ffmpeg "$dir_name/"
81
+ cp ffmpeg*/bin/ffprobe "$dir_name/"
82
+
83
+ # Copy the latest Jellyfin binary in to the correct folder
84
+ echo "[INFO] Copying Jellyfin Server into bundle..."
85
+ cp -R "$dir_name/." "Jellyfin.app/Contents/MacOS/"
86
+
87
+ # Move the web files to the resource folder
88
+ echo "[INFO] Moving jellyfin-web to resources..."
89
+ mv "Jellyfin.app/Contents/MacOS/jellyfin-web" "Jellyfin.app/Contents/Resources/"
90
+
91
+ # Setup some variables
92
+ APP_NAME="Jellyfin.app"
93
+ ENTITLEMENTS="$BUILD_SOURCESDIRECTORY/deployment/Jellyfin_Server.entitlements"
94
+ SIGNING_IDENTITY="739426E195172DE44249548E1DC1CBFA797AEF3A" # matches Keychain Access certificate name
95
+
96
+ # Iterate through contents that should be signed, and sign them
97
+ find "$APP_NAME/Contents/MacOS" -type f | while read fname; do
98
+ echo "[INFO] Signing $fname"
99
+ codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign $SIGNING_IDENTITY "$fname"
100
+ done
101
+
102
+ find "$APP_NAME/Contents/Frameworks" -type f | while read fname; do
103
+ echo "[INFO] Signing $fname"
104
+ codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign $SIGNING_IDENTITY "$fname"
105
+ done
106
+
107
+ echo "[INFO] Signing complete app bundle..."
108
+ codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign $SIGNING_IDENTITY "$APP_NAME"
109
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/build/Release/'
110
+
111
+ - task : UseNode@1
112
+ inputs :
113
+ version : ' 12.x'
114
+
115
+ - task : Npm@1
116
+ inputs :
117
+ command : ' install'
118
+ workingDir : ' $(Build.SourcesDirectory)'
119
+ - task : Bash@3
120
+ inputs :
121
+ targetType : ' inline'
122
+ script : |
123
+ echo "[INFO] Moving resources inline..."
124
+ cp -R "$BUILD_SOURCESDIRECTORY/deployment/." "."
125
+ echo "[INFO] Creating DMG..."
126
+ npx appdmg "jfdmg.json" "Jellyfin.dmg"
127
+ echo "[INFO] Uploading for notarization..."
128
+ xcrun altool --notarize-app --primary-bundle-id "jellyfin-server-macos" --username "$DEVUSER" --password "$DEVPASS" --file "Jellyfin.dmg"
129
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/build/Release/'
130
+ env :
131
+ DEVUSER : $(AppleDevAccount)
132
+ DEVPASS : $(AppleDevPassword)
133
+
134
+ - task : PublishBuildArtifacts@1
135
+ displayName : ' Bundle Release'
136
+ inputs :
137
+ PathtoPublish : ' $(System.DefaultWorkingDirectory)/build/Release/Jellyfin.dmg'
138
+ ArtifactName : ' jellyfin-macos-wrapper.zip'
139
+ publishLocation : ' Container'
0 commit comments