Skip to content

Commit db031ef

Browse files
Merge pull request #43 from auto-yui-patch/nodejs-to-pwsh
feat: Optimize CI by switching to Ubuntu runners and using PowerShell
2 parents 7f66e9f + 8c5fc39 commit db031ef

File tree

4 files changed

+125
-130
lines changed

4 files changed

+125
-130
lines changed

.github/workflows/cp_dispatch.yml

Lines changed: 24 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
version_to_patch:
77
description: 'The Version You Want to Patch'
88
required: true
9-
default: '6.0.0'
9+
default: '7.0.0'
1010
os-and-arch:
1111
description: 'Operating System And Architecture'
1212
required: true
@@ -39,6 +39,10 @@ on:
3939
required: true
4040
default: 'Google'
4141

42+
defaults:
43+
run:
44+
shell: pwsh
45+
4246
env:
4347
OS_ARCH: ${{ github.event.inputs.os-and-arch }}
4448
VERSION_TO_PATCH: ${{ github.event.inputs.version_to_patch }}
@@ -52,68 +56,28 @@ env:
5256
jobs:
5357

5458
validate-version:
55-
runs-on: windows-latest
59+
runs-on: ubuntu-latest
5660
outputs:
5761
is_valid: ${{ steps.get_validity.outputs.is_valid }}
58-
59-
env:
60-
NODE_JS_VERSION: 23.1.0
61-
62+
6263
steps:
6364
- uses: actions/checkout@v4
6465

65-
- name: Use Node.js ${{ env.NODE_JS_VERSION }}
66-
uses: actions/setup-node@v4
67-
with:
68-
node-version: ${{ env.NODE_JS_VERSION }}
69-
cache: 'npm' # Auto-caches npm dependencies
70-
cache-dependency-path: utils/fe-version-validator/package-lock.json
71-
72-
- name: Install Node.js dependencies
73-
run: npm ci
74-
working-directory: utils/fe-version-validator
75-
76-
- name: Run the Node.js script
77-
run: node .
78-
working-directory: utils/fe-version-validator
79-
80-
- name: Get Version Validity
66+
- name: Validate Fiddler Version
8167
id: get_validity
82-
shell: pwsh
68+
working-directory: utils/fe-version-validator
8369
run: |
84-
$filePath = "utils/fe-version-validator/versions.txt"
85-
$isValid = 'false'
86-
$patchingVersion = $env:VERSION_TO_PATCH
87-
88-
if (-not [string]::IsNullOrEmpty($patchingVersion)) {
89-
if (Select-String -Path $filePath -Pattern $patchingVersion) {
90-
$compareVersion = "5.9.0"
91-
92-
if ([version]$patchingVersion -ge [version]$compareVersion) {
93-
$isValid = 'true'
94-
Write-Output "Valid Version found."
95-
} else {
96-
Write-Output "Version not Compatible."
97-
}
98-
} else {
99-
Write-Output "Version Empty."
100-
}
101-
} else {
102-
Write-Output "Version not found in List!"
103-
}
104-
105-
echo "is_valid=$isValid" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
70+
./Validate-FEVersion.ps1 -VersionToPatch $env:VERSION_TO_PATCH
10671
10772
init_os_arch:
108-
runs-on: windows-latest
73+
runs-on: ubuntu-latest
10974
outputs:
11075
library_extension: ${{ steps.set_library_extension.outputs.library_extension }}
11176
arch_code: ${{ steps.set_arch.outputs.arch_code }}
11277

11378
steps:
11479
- name: Set Library Extension (dll / so / dylib)
11580
id: set_library_extension
116-
shell: pwsh
11781
run: |
11882
$extension = 'not-selected'
11983
@@ -131,7 +95,6 @@ jobs:
13195

13296
- name: Set Library Extension (dll / so / dylib)
13397
id: set_arch
134-
shell: pwsh
13598
run: |
13699
$arch = 'not-selected'
137100
@@ -152,7 +115,7 @@ jobs:
152115
"arch_code=$arch" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
153116

154117
download-Yui-patch:
155-
runs-on: windows-latest
118+
runs-on: ubuntu-latest
156119
needs:
157120
- validate-version
158121
- init_os_arch
@@ -184,40 +147,37 @@ jobs:
184147
echo "IS_COMPATIBLE_CONT=false" | Out-File -Append -FilePath $env:GITHUB_ENV
185148
}
186149

187-
shell: pwsh
188-
189150
- name: Set IS_COMPATIBLE_CONT as Output
190151
id: is-compatible-cont
191-
run: echo "is-compatible-cont=${{ env.IS_COMPATIBLE_CONT }}" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
152+
run: echo "is-compatible-cont=${{ env.IS_COMPATIBLE_CONT }}" >> $env:GITHUB_OUTPUT
192153

193154
- name: Set Yui name
194-
run: echo "YUI_NAME=yui" | Out-File -Append -FilePath $env:GITHUB_ENV
155+
run: echo "YUI_NAME=yui" >> $env:GITHUB_ENV
195156

196157
- name: Set Yui fiddler name (>= 5.17.0)
197158
if: env.IS_COMPATIBLE_CONT == 'true'
198159
run: |
199-
echo "Yui_FIDDLER_NAME=fiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
200-
echo "Yui_FIDDLER_NAME_NO_EXTENSION=fiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
160+
echo "Yui_FIDDLER_NAME=fiddler.$env:LIBRARY_EXTENSION" >> $env:GITHUB_ENV
161+
echo "Yui_FIDDLER_NAME_NO_EXTENSION=fiddler" >> $env:GITHUB_ENV
201162
202163
- name: Set Yui fiddler name (< 5.17.0 or on linux)
203164
if: env.IS_COMPATIBLE_CONT == 'false' || env.OS_ARCH == 'Linux (x86_64)'
204165
run: |
205-
echo "Yui_FIDDLER_NAME=libfiddler.$env:LIBRARY_EXTENSION" | Out-File -Append -FilePath $env:GITHUB_ENV
206-
echo "Yui_FIDDLER_NAME_NO_EXTENSION=libfiddler" | Out-File -Append -FilePath $env:GITHUB_ENV
166+
echo "Yui_FIDDLER_NAME=libfiddler.$env:LIBRARY_EXTENSION" >> $env:GITHUB_ENV
167+
echo "Yui_FIDDLER_NAME_NO_EXTENSION=libfiddler" >> $env:GITHUB_ENV
207168
208169
- name: Set Yui_FIDDLER_NAME as Output
209170
id: Yui-fiddler-name
210-
run: echo "Yui-fiddler-name=${{ env.Yui_FIDDLER_NAME }}" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
171+
run: echo "Yui-fiddler-name=${{ env.Yui_FIDDLER_NAME }}" >> $env:GITHUB_OUTPUT
211172

212173
- name: Create Yui directory
213174
run: |
214175
if (-Not (Test-Path "Yui")) {
215176
New-Item -ItemType Directory -Path "Yui"
216177
}
217-
shell: pwsh
218178
219179
- name: Set Yui Release
220-
run: echo "Yui_RELEASE=continuous" | Out-File -Append -FilePath $env:GITHUB_ENV
180+
run: echo "Yui_RELEASE=continuous" >> $env:GITHUB_ENV
221181

222182
- name: Download Yui Patch
223183
run: |
@@ -238,7 +198,6 @@ jobs:
238198
Write-Error "Failed to download the patch files. Error details: $_"
239199
exit 1
240200
}
241-
shell: pwsh
242201
243202
- name: Upload Yui folder as an artifact
244203
uses: actions/upload-artifact@v4
@@ -248,7 +207,7 @@ jobs:
248207
if-no-files-found: error
249208

250209
download-msojocs-server:
251-
runs-on: windows-latest
210+
runs-on: ubuntu-latest
252211

253212
if: ${{ needs.validate-version.outputs.is_valid }} == 'true'
254213

@@ -261,13 +220,13 @@ jobs:
261220
262221
- name: Configure sparse-checkout to download the server directory
263222
run: |
264-
echo "server" | Out-File -Append -FilePath .git\info\sparse-checkout
223+
Set-Content -Path ".git/info/sparse-checkout" -Value "server"
265224
git pull origin main
266225
267226
- name: Move the downloaded directory to the target folder
268227
run: |
269228
mkdir -p msojocs
270-
Move-Item -Path server -Destination msojocs/
229+
Move-Item -Path "server" -Destination "msojocs/"
271230
272231
- name: List files in the msojocs/server directory
273232
run: Get-ChildItem -Path msojocs\server
@@ -281,7 +240,7 @@ jobs:
281240

282241
download-fiddler-everywhere-windows:
283242
if: ${{ github.event.inputs.os-and-arch == 'Windows (x86_64)' }}
284-
runs-on: windows-latest
243+
runs-on: ubuntu-latest
285244
needs:
286245
- validate-version
287246

@@ -303,14 +262,12 @@ jobs:
303262
Write-Host "PATCHING_VERSION is empty or not set"
304263
exit 1
305264
}
306-
shell: pwsh
307265
308266
- name: Extract exe
309267
run: 7z x "FiddlerEverywhereSetup.exe" -ofe_extracted
310268

311269
- name: Extract app
312270
run: 7z x "fe_extracted/`$PLUGINSDIR/app-64.7z" -ofe_app
313-
shell: pwsh
314271

315272
- name: Upload Fiddler Everywhere Extracted folder as an artifact
316273
uses: actions/upload-artifact@v4
@@ -343,7 +300,6 @@ jobs:
343300
Write-Host "VERSION_TO_PATCH is empty or not set"
344301
exit 1
345302
}
346-
shell: pwsh
347303
348304
- name: Extract AppImage
349305
run: |
@@ -397,15 +353,13 @@ jobs:
397353
Write-Host "VERSION_TO_PATCH is empty or not set"
398354
exit 1
399355
}
400-
shell: pwsh
401356
402357
- name: Extract AppImage
403358
run: |
404359
hdiutil attach FiddlerEverywhere.dmg
405360
cp -R /Volumes/FiddlerEverywhere/* ./fe_app/
406361
407362
- name: List fe_app
408-
shell: pwsh
409363
run: Get-ChildItem -Recurse
410364

411365
- name: Upload Fiddler Everywhere Extracted folder as an artifact
@@ -454,7 +408,6 @@ jobs:
454408
Get-ChildItem -Recurse Yui-patch
455409
Get-ChildItem -Recurse msojocs-patch
456410
Get-ChildItem -Recurse fe_app
457-
shell: pwsh
458411
459412
- name: Rename main FE folder
460413
run: Rename-Item -Path "fe_app" -NewName "FE"
@@ -470,7 +423,6 @@ jobs:
470423
} else {
471424
Write-Host "fiddler / libfiddler or Yui patch not found"
472425
}
473-
shell: pwsh
474426
475427
- name: Clean Yui-patch
476428
run: |
@@ -490,7 +442,6 @@ jobs:
490442
} else {
491443
Write-Host "Source Server Folder not found"
492444
}
493-
shell: pwsh
494445
495446
- name: Set patch server port (in main.js of server)
496447
run: |

0 commit comments

Comments
 (0)