Skip to content

Commit 4fdcede

Browse files
Update cp_latest_dispatch.yml
1 parent 4ee991a commit 4fdcede

File tree

1 file changed

+97
-23
lines changed

1 file changed

+97
-23
lines changed

.github/workflows/cp_latest_dispatch.yml

Lines changed: 97 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,53 @@ name: Latest Version - Workflow Dispatch
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
os-and-arch:
7+
description: 'Operating System And Architecture'
8+
required: true
9+
default: '6.0.0'
10+
type: choice
11+
options:
12+
- Windows (x86_64)
13+
- Linux (x86_64)
14+
- Mac (arm64)
15+
- Mac (arm64e)
16+
- Mac (x86_64)
17+
18+
env:
19+
OS_ARCH: ${{ github.event.inputs.os-and-arch }}
520

621
jobs:
22+
23+
init_os_arch:
24+
runs-on: windows-latest
25+
outputs:
26+
library_extension: ${{ steps.set_library_extension.outputs.library_extension }}
27+
28+
steps:
29+
- name: Set Library Extension (dll / so / dylib)
30+
id: set_library_extension
31+
shell: pwsh
32+
run: |
33+
$extension = 'not-selected'
34+
35+
if ($env:OS_ARCH -eq 'Windows (x86_64)') {
36+
$extension = 'dll'
37+
} elseif ($env:OS_ARCH -eq 'Linux (x86_64)') {
38+
$extension = 'so'
39+
} elseif ($env:OS_ARCH -eq 'Mac (arm64)' -or $env:OS_ARCH -eq 'Mac (arm64e)' -or $env:OS_ARCH -eq 'Mac (x86_64)') {
40+
$extension = 'dylib'
41+
} else {
42+
throw "Unsupported OS architecture: $env:OS_ARCH"
43+
}
44+
45+
"library_extension=$extension" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
46+
747
scrape_fe_version:
848
runs-on: windows-latest
49+
needs:
50+
- init_os_arch
51+
952
outputs:
1053
scraped_version: ${{ steps.set_scraped_version.outputs.scraped_version }}
1154

@@ -43,6 +86,7 @@ jobs:
4386

4487
env:
4588
SCRAPED_VERSION: ${{ needs.scrape_fe_version.outputs.scraped_version }}
89+
LIBRARY_EXTENSION: ${{ needs.init_os_arch.outputs.library_extension }}
4690

4791
outputs:
4892
is-compatible-cont: ${{ steps.is-compatible-cont.outputs.is-compatible-cont }}
@@ -71,21 +115,16 @@ jobs:
71115
id: is-compatible-cont
72116
run: echo "is-compatible-cont=${{ env.IS_COMPATIBLE_CONT }}" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
73117

74-
- name: Set Yui name (>= 5.17.0)
75-
if: env.IS_COMPATIBLE_CONT == 'true'
118+
- name: Set Yui name
76119
run: echo "YUI_NAME=yui" | Out-File -Append -FilePath $env:GITHUB_ENV
77-
78-
- name: Set Yui name (< 5.17.0)
79-
if: env.IS_COMPATIBLE_CONT == 'false'
80-
run: echo "YUI_NAME=yukihana" | Out-File -Append -FilePath $env:GITHUB_ENV
81120

82121
- name: Set Yui fiddler name (>= 5.17.0)
83122
if: env.IS_COMPATIBLE_CONT == 'true'
84-
run: echo "Yui_FIDDLER_NAME=fiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
123+
run: echo "Yui_FIDDLER_NAME=fiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
85124

86-
- name: Set Yui fiddler name (< 5.17.0)
87-
if: env.IS_COMPATIBLE_CONT == 'false'
88-
run: echo "Yui_FIDDLER_NAME=libfiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
125+
- name: Set Yui fiddler name (< 5.17.0 or on linux)
126+
if: env.IS_COMPATIBLE_CONT == 'false' || env.OS_ARCH == 'Linux (x86_64)'
127+
run: echo "Yui_FIDDLER_NAME=libfiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
89128

90129
- name: Set Yui_FIDDLER_NAME as Output
91130
id: Yui-fiddler-name
@@ -98,26 +137,22 @@ jobs:
98137
}
99138
shell: pwsh
100139

101-
- name: Set Yui Release (>= 5.17.0)
102-
if: env.IS_COMPATIBLE_CONT == 'true'
140+
- name: Set Yui Release
141+
if: env.IS_COMPATIBLE_CONT == 'true'
103142
run: echo "Yui_RELEASE=continuous" | Out-File -Append -FilePath $env:GITHUB_ENV
104-
105-
- name: Set Yui Release (< 5.17.0)
106-
if: env.IS_COMPATIBLE_CONT == 'false'
107-
run: echo "Yui_RELEASE=v1.0.9" | Out-File -Append -FilePath $env:GITHUB_ENV
108143

109144
- name: Download Yui Patch
110145
run: |
111146
try {
112147
# Build the download URLs
113-
$YuiFiddlerUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-$env:Yui_FIDDLER_NAME-win32-x86_64-$env:Yui_RELEASE.dll"
148+
$YuiFiddlerUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-fiddler-win32-x86_64-$env:Yui_RELEASE.$env:LIBRARY_EXTENSION"
114149
115150
# Print the URLs to ensure they're correct
116151
Write-Host "Downloading files from $env:Yui_RELEASE"
117152
Write-Host "Yui Fiddler URL: $YuiFiddlerUrl"
118153
119154
# Download the files
120-
Invoke-WebRequest -Uri $YuiFiddlerUrl -OutFile "Yui\$env:Yui_FIDDLER_NAME.dll"
155+
Invoke-WebRequest -Uri $YuiFiddlerUrl -OutFile "Yui\$env:Yui_FIDDLER_NAME"
121156
}
122157
catch {
123158
Write-Error "Failed to download the patch files. Error details: $_"
@@ -162,9 +197,9 @@ jobs:
162197
path: msojocs/
163198
if-no-files-found: error
164199

165-
download-fiddler-everywhere:
200+
download-fiddler-everywhere-windows:
201+
if: env.OS_ARCH == 'Windows (x86_64)'
166202
runs-on: windows-latest
167-
168203
needs:
169204
- scrape_fe_version
170205

@@ -202,13 +237,52 @@ jobs:
202237
path: fe_app64/
203238
if-no-files-found: error
204239

240+
download-fiddler-everywhere-linux:
241+
if: env.OS_ARCH == 'Linux (x86_64)'
242+
runs-on: ubuntu-latest
243+
needs:
244+
- scrape_fe_version
245+
246+
steps:
247+
- name: Build URL & Download
248+
run: |
249+
# Retrieve the scraped version from the previous step
250+
$scrapedVersion = "${{ needs.scrape_fe_version.outputs.scraped_version }}"
251+
252+
# Check if the scraped version is available
253+
if (-not [string]::IsNullOrEmpty($scrapedVersion)) {
254+
$downloadUrl = "https://downloads.getfiddler.com/linux/fiddler-everywhere-$scrapedVersion.AppImage"
255+
256+
Write-Host "Download URL: $downloadUrl"
257+
258+
Invoke-WebRequest -Uri $downloadUrl -OutFile "FiddlerEverywhereSetup.AppImage"
259+
260+
} else {
261+
Write-Host "SCRAPED_VERSION is empty or not set"
262+
exit 1
263+
}
264+
shell: pwsh
265+
266+
- name: Extract AppImage
267+
run: |
268+
./FiddlerEverywhereSetup.AppImage --appimage-extract
269+
ls -l
270+
271+
- name: Upload Fiddler Everywhere Extracted folder as an artifact
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: fe_app64
275+
path: fe_app64/
276+
if-no-files-found: error
277+
205278
patch_fe:
206279
runs-on: windows-latest
207280

208281
needs:
209282
- download-Yui-patch
210283
- download-msojocs-server
211-
- download-fiddler-everywhere
284+
- download-fiddler-everywhere-windows
285+
- download-fiddler-everywhere-linux
212286
- scrape_fe_version
213287

214288
env:
@@ -248,8 +322,8 @@ jobs:
248322

249323
- name: Patch fiddler.dll / libfiddler.dll
250324
run: |
251-
$original_fiddler = "FE/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}.dll"
252-
$Yui_fiddler = "Yui-patch/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}.dll"
325+
$original_fiddler = "FE/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}"
326+
$Yui_fiddler = "Yui-patch/${{ needs.download-Yui-patch.outputs.Yui-fiddler-name }}"
253327
254328
if ((Test-Path $original_fiddler) -and (Test-Path $Yui_fiddler)) {
255329
Copy-Item -Path $Yui_fiddler -Destination $original_fiddler -Force

0 commit comments

Comments
 (0)