Skip to content

Commit a9f4102

Browse files
authored
Merge pull request winpython#1908 from stonebig/master
simplify further github action
2 parents 42fe1a9 + ce6ae32 commit a9f4102

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

.github/workflows/github_workflows_build-2025_05.yml

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -164,36 +164,29 @@ jobs:
164164
echo "python_sha256=0ae8237881058aafb4bdf8ae9468e4791a5f3fd277a99bd90b7cb1175b96f0cb" >> $GITHUB_ENV
165165
fi
166166
167-
- name: Download python-3 standalone
167+
- name: Download, verify and extract python standalone
168168
if: env.WINPYREQUIREMENTS != ''
169169
shell: pwsh
170170
run: |
171-
Write-Output "python_source used is $env:python_source"
171+
Write-Output "Downloading, hash-checking, and extracting $env:python_source"
172172
curl.exe -L -o "python-3-embed.tar.gz" $env:python_source
173-
# Calculate SHA256 hash
174-
$expectedHash = $env:python_sha256
175-
$actualHash = (Get-FileHash -Path "python-3-embed.tar.gz" -Algorithm SHA256).Hash.ToLower()
176-
177-
if ($actualHash -eq $expectedHash.ToLower()) {
178-
Write-Output "Hash matches."
179-
} else {
180-
Write-Error "Hash does NOT match: $actualHash vs expected $expectedHash"
181-
exit 1
182-
}
183173
184-
- name: Extract python-3-embed.tar.gz to dotpython
185-
if: env.WINPYREQUIREMENTS != ''
186-
shell: bash
187-
run: |
188-
mkdir -p dotpythonpre
189-
mkdir -p dotpython
190-
mkdir -p dotpython/python
174+
$expectedHash = $env:python_sha256
175+
$actualHash = (Get-FileHash -Path "python-3-embed.tar.gz" -Algorithm SHA256).Hash.ToLower() $actualHash = $hashObject.Hash.ToLower()
176+
if ($actualHash -ne $expectedHash.ToLower()) {
177+
Write-Error "SHA mismatch: Actual $actualHash doesn't match $expectedHash"
178+
exit 1
179+
} else { Write-Output "Python SHA ok" }
180+
181+
mkdir dotpythonpre -Force
182+
mkdir dotpython -Force
183+
mkdir dotpython/python -Force
191184
tar -xf python-3-embed.tar.gz -C dotpythonpre
192-
if [ -d dotpythonpre/python/install ]; then
193-
mv dotpythonpre/python/install/* dotpython/python/
194-
elif [ -d dotpythonpre/python ]; then
195-
mv dotpythonpre/python/* dotpython/python/
196-
fi
185+
if (Test-Path dotpythonpre/python/install) {
186+
Move-Item -Path dotpythonpre/python/install/* -Destination dotpython/python -Force
187+
} elseif (Test-Path dotpythonpre/python) {
188+
Move-Item -Path dotpythonpre/python/* -Destination dotpython/python -Force
189+
}
197190
198191
- name: Copy launchers_final files to dotpython
199192
if: env.WINPYREQUIREMENTS != ''
@@ -216,7 +209,7 @@ jobs:
216209
New-Item -ItemType Directory -Path $env:build_location
217210
Get-ChildItem -Path dotpython -Force | Move-Item -Destination $env:build_location -Force
218211
219-
- name: Download and integrate pandoc binary
212+
- name: Download, checking hash and integrating pandoc binary
220213
if: env.WINPYREQUIREMENTS != '' && env.PANDOC == '1'
221214
shell: pwsh
222215
run: |
@@ -229,11 +222,11 @@ jobs:
229222
Expand-Archive -Path $pandocZipPath -DestinationPath $tempDir -Force
230223
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
231224
232-
Write-Host "Copying pandoc.exe to $targetDir"
225+
Write-Output "Copying pandoc.exe to $targetDir"
233226
Copy-Item -Path (Join-Path $tempDir "pandoc-3.1.9\pandoc.exe") -Destination $targetDir -Force
234227
235228
# Optional: Verify the contents
236-
Write-Host "Listing contents of $targetDir"
229+
Write-Output "Listing contents of $targetDir"
237230
Get-ChildItem -Path $targetDir
238231
239232
$expectedHash = $env:pandoc_sha256.ToLower()
@@ -242,9 +235,9 @@ jobs:
242235
if ($actualHash -ne $expectedHash) {
243236
Write-Error "Pandoc SHA mismatch: $actualHash vs expected $expectedHash"
244237
exit 1
245-
} else { Write-Host "Pandoc SHA ok" }
238+
} else { Write-Output "Pandoc SHA ok" }
246239
247-
Write-Host "Cleaning up temporary files..."
240+
Write-Output "Cleaning up temporary files..."
248241
Remove-Item -Path $tempDir -Recurse -Force
249242
Remove-Item -Path $pandocZipPath -Force
250243

0 commit comments

Comments
 (0)