forked from wojiushixiaobai/Python-Embed-Win64
-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (95 loc) · 3.49 KB
/
Copy pathembed.yml
File metadata and controls
107 lines (95 loc) · 3.49 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Python for Embed Release Version
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
env:
latest_version: '3.14'
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
version: ['3.10', '3.11', '3.12', '3.13', '3.14']
arch: ['x86', 'x64']
steps:
- name: Get version
run: |
$json = Invoke-RestMethod -Uri https://github.com/docker-library/python/raw/refs/heads/master/versions.json
$version = $json."${{ matrix.version }}".version
if (-not $version) {
Write-Error "Version is empty or null. Exiting."
exit 1
}
Write-Output "version=$version" >> $env:GITHUB_ENV
Write-Output "tag=v$version" >> $env:GITHUB_ENV
Write-Output "Current version is $version"
- name: Check Release
run: |
if ! gh release view ${{ env.version }} -R ${{ github.repository }} > /dev/null 2>&1; then
echo "Release ${{ env.version }} does not exist. Continuing with the build."
echo "build=1" >> $GITHUB_ENV
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
if: env.build == '1'
uses: actions/checkout@v5
with:
path: main
- name: Checkout CPython
if: env.build == '1'
uses: actions/checkout@v5
with:
repository: python/cpython
ref: ${{ env.tag }}
path: cpython
- name: Reset Config
if: env.build == '1'
run: |
sed -i 's@ --dirty@@g' PCbuild/pythoncore.vcxproj
sed -i 's@--precompile@--precompile --include-pip --include-tcltk@g' Tools/msi/make_zip.proj
cat Tools/msi/make_zip.proj | grep 'stable'
shell: bash
working-directory: cpython
- name: Create embed layout
if: env.build == '1'
run: |
Tools\\msi\\buildrelease.bat -${{ matrix.arch }} --skip-doc --skip-pgo --skip-msi --skip-nuget
working-directory: cpython
- name: Move embed layout
if: env.build == '1'
run: |
$arch = '${{ matrix.arch }}'
$source = switch ($arch) {
'x64' { 'cpython\PCbuild\amd64\en-us' }
'x86' { 'cpython\PCbuild\win32\en-us' }
'arm64' { 'cpython\PCbuild\arm64\en-us' }
}
$destination = 'main\dist'
Move-Item -Path $source -Destination $destination -Force
- name: Create Tag
if: env.build == '1'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -a ${{ env.version }} -m "Release Version ${{ env.version }}" || true
git push origin ${{ env.version }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: main
- name: Create Release
if: env.build == '1'
run: |
latestFlag=""
if [ "${{ matrix.version }}" != "${{ env.latest_version }}" ]; then
latestFlag="--latest=false"
fi
gh release create ${{ env.version }} -R ${{ github.repository}} --notes "Python for Stable Release ${{ env.version }}" $latestFlag || true
gh release upload ${{ env.version }} -R ${{ github.repository}} dist/*.zip || true
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: main