-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathaction.yml
More file actions
58 lines (49 loc) · 1.93 KB
/
action.yml
File metadata and controls
58 lines (49 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: 'WinPython Standalone Setup'
description: 'Downloads, verifies, and extracts Python Build Standalone'
inputs:
python_source:
description: 'URL of the python tar.gz'
required: true
python_sha256:
description: 'Expected SHA256'
required: true
build_location:
description: 'Target directory name'
required: true
runs:
using: "composite"
steps:
- name: Download and Extract python
shell: pwsh
run: |
$archive = "python-3-embed.tar.gz"
Write-Host "Downloading: ${{ inputs.python_source }}"
curl.exe -L -o $archive "${{ inputs.python_source }}"
# Hash Verification
$actualHash = (Get-FileHash -Path $archive -Algorithm SHA256).Hash.ToLower()
if ($actualHash -ne "${{ inputs.python_sha256 }}".ToLower()) {
Write-Error "SHA mismatch: $actualHash"
exit 1
}
# Setup Folders
mkdir "dotpythonpre" -Force
mkdir "dotpython/python" -Force
# Extract
tar -xf $archive -C "dotpythonpre"
# Handle different internal structures (install vs root)
if (Test-Path "dotpythonpre/python/install") {
Move-Item -Path "dotpythonpre/python/install/*" -Destination "dotpython/python" -Force
} else {
Move-Item -Path "dotpythonpre/python/*" -Destination "dotpython/python" -Force
}
# Copy launchers_final files to dotpython
Copy-Item -Path "winpython/portable/launchers_final/*" -Destination "dotpython/" -Recurse -Force
New-Item -Path $env:dotwheelhouse -ItemType Directory -Force
Get-ChildItem dotpython
Get-ChildItem dotpython\python
# Move to final location
mkdir "${{ inputs.build_location }}" -Force
Move-Item -Path "dotpython/*" -Destination "${{ inputs.build_location }}" -Force
# Cleanup
Remove-Item "dotpythonpre" -Recurse -Force
Remove-Item $archive -Force