77 description : ' The Version You Want to Patch'
88 required : true
99 default : ' 6.0.0'
10+ os-and-arch :
11+ description : ' Operating System And Architecture'
12+ required : true
13+ type : choice
14+ options :
15+ - Windows (x86_64)
16+ - Linux (x86_64)
1017
1118env :
19+ OS_ARCH : ${{ github.event.inputs.os-and-arch }}
1220 VERSION_TO_PATCH : ${{ github.event.inputs.version_to_patch }}
1321
14- jobs :
22+ jobs :
1523
1624 validate-version :
1725 runs-on : windows-latest
@@ -65,21 +73,76 @@ jobs:
6573 }
6674
6775 echo "is_valid=$isValid" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
68-
69- download-Yui-patch :
76+
77+ init_os_arch :
7078 runs-on : windows-latest
79+ outputs :
80+ library_extension : ${{ steps.set_library_extension.outputs.library_extension }}
81+ arch_code : ${{ steps.set_arch.outputs.arch_code }}
7182
72- needs : validate-version
83+ needs :
84+ - validate-version
85+
86+ steps :
87+ - name : Set Library Extension (dll / so / dylib)
88+ id : set_library_extension
89+ shell : pwsh
90+ run : |
91+ $extension = 'not-selected'
92+
93+ if ($env:OS_ARCH -eq 'Windows (x86_64)') {
94+ $extension = 'dll'
95+ } elseif ($env:OS_ARCH -eq 'Linux (x86_64)') {
96+ $extension = 'so'
97+ } elseif ($env:OS_ARCH -eq 'Mac (arm64)' -or $env:OS_ARCH -eq 'Mac (arm64e)' -or $env:OS_ARCH -eq 'Mac (x86_64)') {
98+ $extension = 'dylib'
99+ } else {
100+ throw "Unsupported OS architecture : $env:OS_ARCH"
101+ }
102+
103+ " library_extension=$extension" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
73104
74- if : ${{ needs.validate-version.outputs.is_valid }} == 'true'
105+ - name : Set Library Extension (dll / so / dylib)
106+ id : set_arch
107+ shell : pwsh
108+ run : |
109+ $arch = 'not-selected'
75110
111+ if ($env:OS_ARCH -eq 'Windows (x86_64)') {
112+ $arch = 'win32-x86_64'
113+ } elseif ($env:OS_ARCH -eq 'Linux (x86_64)') {
114+ $arch = 'linux-x86_64'
115+ } elseif ($env:OS_ARCH -eq 'Mac (arm64)') {
116+ $arch = 'mac-arm64'
117+ } elseif ($env:OS_ARCH -eq 'Mac (arm64e)') {
118+ $arch = 'mac-arm64e'
119+ } elseif ($env:OS_ARCH -eq 'Mac (x86_64)') {
120+ $arch = 'mac-x86_64'
121+ } else {
122+ throw "Unsupported OS architecture : $env:OS_ARCH"
123+ }
124+
125+ " arch_code=$arch" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
126+
127+ download-Yui-patch :
128+ runs-on : windows-latest
129+ needs :
130+ - validate-version
131+ - init_os_arch
132+
133+ if : ${{ needs.validate-version.outputs.is_valid }} == 'true'
134+
135+ env :
136+ LIBRARY_EXTENSION : ${{ needs.init_os_arch.outputs.library_extension }}
137+ ARCH_CODE : ${{ needs.init_os_arch.outputs.arch_code }}
138+
76139 outputs :
77140 is-compatible-cont : ${{ steps.is-compatible-cont.outputs.is-compatible-cont }}
78141 Yui-fiddler-name : ${{ steps.Yui-fiddler-name.outputs.Yui-fiddler-name }}
79142
80143 steps :
81- - name : Compare Patching Version Compatible with 5.17.0
82- id : version_check
144+ - name : Compare VERSION_TO_PATCH with 5.17.0
145+ id : version_to_patch_check
83146 run : |
84147 $patchingVersion = $env:VERSION_TO_PATCH
85148 $compareVersion = "5.17.0"
@@ -100,16 +163,20 @@ jobs:
100163 id : is-compatible-cont
101164 run : echo "is-compatible-cont=${{ env.IS_COMPATIBLE_CONT }}" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
102165
103- - name : Set Yui name
166+ - name : Set Yui name
104167 run : echo "YUI_NAME=yui" | Out-File -Append -FilePath $env:GITHUB_ENV
105168
106169 - name : Set Yui fiddler name (>= 5.17.0)
107170 if : env.IS_COMPATIBLE_CONT == 'true'
108- run : echo "Yui_FIDDLER_NAME=fiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
171+ run : |
172+ echo "Yui_FIDDLER_NAME=fiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
173+ echo "Yui_FIDDLER_NAME_NO_EXTENSION=fiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
109174
110- - name : Set Yui fiddler name (< 5.17.0)
111- if : env.IS_COMPATIBLE_CONT == 'false'
112- run : echo "Yui_FIDDLER_NAME=libfiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
175+ - name : Set Yui fiddler name (< 5.17.0 or on linux)
176+ if : env.IS_COMPATIBLE_CONT == 'false' || env.OS_ARCH == 'Linux (x86_64)'
177+ run : |
178+ echo "Yui_FIDDLER_NAME=libfiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
179+ echo "Yui_FIDDLER_NAME_NO_EXTENSION=libfiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
113180
114181 - name : Set Yui_FIDDLER_NAME as Output
115182 id : Yui-fiddler-name
@@ -123,20 +190,23 @@ jobs:
123190 shell : pwsh
124191
125192 - name : Set Yui Release
193+ if : env.IS_COMPATIBLE_CONT == 'true'
126194 run : echo "Yui_RELEASE=continuous" | Out-File -Append -FilePath $env:GITHUB_ENV
127195
128196 - name : Download Yui Patch
129197 run : |
198+ Write-Host "EXTENSION = $env:LIBRARY_EXTENSION"
199+ Write-Host "ARCH CODE = $env:ARCH_CODE"
130200 try {
131201 # Build the download URLs
132- $YuiFiddlerUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-fiddler-win32-x86_64- $env:Yui_RELEASE.dll "
202+ $YuiFiddlerUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-$env:Yui_FIDDLER_NAME_NO_EXTENSION-$env:ARCH_CODE- $env:Yui_RELEASE.$env:LIBRARY_EXTENSION "
133203
134204 # Print the URLs to ensure they're correct
135205 Write-Host "Downloading files from $env:Yui_RELEASE"
136206 Write-Host "Yui Fiddler URL: $YuiFiddlerUrl"
137207
138208 # Download the files
139- Invoke-WebRequest -Uri $YuiFiddlerUrl -OutFile "Yui\$env:Yui_FIDDLER_NAME.dll "
209+ Invoke-WebRequest -Uri $YuiFiddlerUrl -OutFile "Yui\$env:Yui_FIDDLER_NAME"
140210 }
141211 catch {
142212 Write-Error "Failed to download the patch files. Error details: $_"
@@ -154,10 +224,8 @@ jobs:
154224 download-msojocs-server :
155225 runs-on : windows-latest
156226
157- needs : validate-version
158-
159227 if : ${{ needs.validate-version.outputs.is_valid }} == 'true'
160-
228+
161229 steps :
162230 - name : Set up Git
163231 run : |
@@ -185,12 +253,11 @@ jobs:
185253 path : msojocs/
186254 if-no-files-found : error
187255
188- download-fiddler-everywhere :
256+ download-fiddler-everywhere-windows :
257+ if : ${{ github.event.inputs.os-and-arch == 'Windows (x86_64)' }}
189258 runs-on : windows-latest
190-
191- needs : validate-version
192-
193- if : ${{ needs.validate-version.outputs.is_valid }} == 'true'
259+ needs :
260+ - validate-version
194261
195262 steps :
196263 - name : Build URL & Download
@@ -207,23 +274,119 @@ jobs:
207274 Invoke-WebRequest -Uri $downloadUrl -OutFile "FiddlerEverywhereSetup.exe"
208275
209276 } else {
210- Write-Host "VERSION_TO_PATCH is empty or not set"
277+ Write-Host "PATCHING_VERSION is empty or not set"
211278 exit 1
212279 }
213280 shell : pwsh
214281
215282 - name : Extract exe
216283 run : 7z x "FiddlerEverywhereSetup.exe" -ofe_extracted
217284
218- - name : Extract app64
219- run : 7z x "fe_extracted/`$PLUGINSDIR/app-64.7z" -ofe_app64
285+ - name : Extract app
286+ run : 7z x "fe_extracted/`$PLUGINSDIR/app-64.7z" -ofe_app
287+ shell : pwsh
288+
289+ - name : Upload Fiddler Everywhere Extracted folder as an artifact
290+ uses : actions/upload-artifact@v4
291+ with :
292+ name : fe_app
293+ path : fe_app/
294+ if-no-files-found : error
295+
296+ download-fiddler-everywhere-linux :
297+ if : ${{ github.event.inputs.os-and-arch == 'Linux (x86_64)' }}
298+ runs-on : ubuntu-latest
299+ needs :
300+ - validate-version
301+
302+ steps :
303+ - name : Build URL & Download
304+ run : |
305+ # Retrieve the version to patch from the previous step
306+ $patchingVersion = $env:VERSION_TO_PATCH
307+
308+ # Check if the patchingVersion version is available
309+ if (-not [string]::IsNullOrEmpty($patchingVersion)) {
310+ $downloadUrl = "https://downloads.getfiddler.com/linux/fiddler-everywhere-$patchingVersion.AppImage"
311+
312+ Write-Host "Download URL: $downloadUrl"
313+
314+ Invoke-WebRequest -Uri $downloadUrl -OutFile "FiddlerEverywhereSetup.AppImage"
315+
316+ } else {
317+ Write-Host "VERSION_TO_PATCH is empty or not set"
318+ exit 1
319+ }
320+ shell : pwsh
321+
322+ - name : Extract AppImage
323+ run : |
324+ chmod +x ./FiddlerEverywhereSetup.AppImage
325+ ./FiddlerEverywhereSetup.AppImage --appimage-extract
326+
327+ - name : Rename squashfs-root to fe_app
328+ run : mv squashfs-root fe_app
329+
330+ - name : Upload Fiddler Everywhere Extracted folder as an artifact
331+ uses : actions/upload-artifact@v4
332+ with :
333+ name : fe_app
334+ path : fe_app/
335+ if-no-files-found : error
336+
337+ download-fiddler-everywhere-mac :
338+ if : ${{ github.event.inputs.os-and-arch == 'Mac (x86_64)' || github.event.inputs.os-and-arch == 'Mac (arm64)' || github.event.inputs.os-and-arch == 'Mac (arm64e)' }}
339+ runs-on : mac-latest
340+ needs :
341+ - validate-version
342+
343+ env :
344+ ARCH_CODE : ${{ github.event.inputs.arch_code }}
345+
346+ steps :
347+ - name : Build URL & Download
348+ run : |
349+ # Retrieve the version_to_patch version from the previous step
350+ $patchingVersion = $env:VERSION_TO_PATCH
351+
352+ # Check if the version_to_patch version is available
353+ if (-not [string]::IsNullOrEmpty($patchingVersion)) {
354+ $downloadUrl = "null"
355+
356+ if ($env:ARCH_CODE -eq "x86_64") {
357+ $downloadUrl = "https://downloads.getfiddler.com/mac/Fiddler%20Everywhere%20$patchingVersion.dmg"
358+ } elseif ($env:ARCH_CODE -eq "arm64") {
359+ $downloadUrl = "https://downloads.getfiddler.com/mac-arm64/Fiddler%20Everywhere%20$patchingVersion.dmg"
360+ } elseif ($env:ARCH_CODE -eq "arm64e") {
361+ //Don't know
362+ } else {
363+ throw "Unsupported OS architecture: $env:ARCH_CODE"
364+ }
365+
366+ Write-Host "Download URL: $downloadUrl"
367+
368+ Invoke-WebRequest -Uri $downloadUrl -OutFile "FiddlerEverywhereSetup.dmg"
369+
370+ } else {
371+ Write-Host "VERSION_TO_PATCH is empty or not set"
372+ exit 1
373+ }
374+ shell : pwsh
375+
376+ - name : Extract AppImage
377+ run : |
378+ hdiutil attach FiddlerEverywhere.dmg
379+ cp -R /Volumes/FiddlerEverywhere/* ./fe_app/
380+
381+ - name : List fe_app
220382 shell : pwsh
383+ run : Get-ChildItem -Recurse
221384
222385 - name : Upload Fiddler Everywhere Extracted folder as an artifact
223386 uses : actions/upload-artifact@v4
224387 with :
225- name : fe_app64
226- path : fe_app64 /
388+ name : fe_app
389+ path : fe_app /
227390 if-no-files-found : error
228391
229392 patch_fe :
@@ -232,7 +395,11 @@ jobs:
232395 needs :
233396 - download-Yui-patch
234397 - download-msojocs-server
235- - download-fiddler-everywhere
398+ - validate-version
399+ - download-fiddler-everywhere-windows
400+ - download-fiddler-everywhere-linux
401+ - download-fiddler-everywhere-mac
402+ if : always()
236403
237404 outputs :
238405 patched-fe-name : ${{ steps.rename-fe.outputs.patched-fe-name }}
@@ -253,23 +420,23 @@ jobs:
253420 - name : Download FE
254421 uses : actions/download-artifact@v4
255422 with :
256- name : fe_app64
257- path : fe_app64
423+ name : fe_app
424+ path : fe_app
258425
259426 - name : List the contents of the downloaded artifacts
260427 run : |
261428 Get-ChildItem -Recurse Yui-patch
262429 Get-ChildItem -Recurse msojocs-patch
263- Get-ChildItem -Recurse fe_app64
430+ Get-ChildItem -Recurse fe_app
264431 shell : pwsh
265432
266433 - name : Rename main FE folder
267- run : Rename-Item -Path "fe_app64 " -NewName "FE"
434+ run : Rename-Item -Path "fe_app " -NewName "FE"
268435
269436 - name : Patch fiddler.dll / libfiddler.dll
270437 run : |
271- $original_fiddler = "FE/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}.dll "
272- $Yui_fiddler = "Yui-patch/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}.dll "
438+ $original_fiddler = "FE/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}"
439+ $Yui_fiddler = "Yui-patch/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}"
273440
274441 if ((Test-Path $original_fiddler) -and (Test-Path $Yui_fiddler)) {
275442 Copy-Item -Path $Yui_fiddler -Destination $original_fiddler -Force
0 commit comments