Skip to content

Commit fecf583

Browse files
authored
Revert "Merge branch 'dev' into main(#25)" (#27)
This reverts commit 18fd015.
1 parent 18fd015 commit fecf583

7 files changed

Lines changed: 140 additions & 555 deletions

File tree

.github/workflows/dev_package_and_upload.yml

Lines changed: 18 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -2,120 +2,37 @@ name: Nuitka Package and Upload(dev)
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
test:
7-
description: '测试'
8-
required: true
9-
type: boolean
10-
default: true
11-
config_path:
12-
description: '测试模式时用的配置文件路径(非测试时请忽略)'
13-
required: true
14-
type: string
15-
default: 'package/nuitka_test_config.yml'
16-
# push:
17-
# branches:
18-
# - dev
19-
# paths:
20-
# - 'package/nuitka_config.yml'
5+
push:
6+
branches:
7+
- dev
8+
paths:
9+
- 'package/nuitka_config.yml'
2110

2211
jobs:
2312
package-and-upload:
24-
runs-on: ${{ matrix.os }}
25-
strategy:
26-
matrix:
27-
os: [ubuntu-latest,ubuntu-24.04-arm,windows-latest] # windows-11-arm没有对应的 Python
28-
env:
29-
PYTHON_VERSION: '3.10'
30-
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
31-
UPXVERSION: '5.0.1'
13+
runs-on: windows-latest
3214

3315
# 添加必要的权限
3416
permissions:
3517
contents: write # 允许创建发布和上传资源
3618

3719
steps:
38-
39-
- name: Checkout code
40-
uses: actions/checkout@v4
41-
42-
- name: Set Timezone to China Standard Time on Windows
43-
if: ${{ runner.os == 'Windows' }}
20+
- name: Set Timezone to China Standard Time
4421
run: tzutil /s "China Standard Time"
4522
shell: pwsh
4623

47-
- name: Set Timezone to China Standard Time on Linux
48-
if: ${{ runner.os == 'Linux' }}
49-
run: sudo timedatectl set-timezone Asia/Shanghai
50-
24+
- name: Checkout code
25+
uses: actions/checkout@v4
5126

5227
- name: Set up Python
5328
uses: actions/setup-python@v5
5429
with:
55-
python-version: ${{ env.PYTHON_VERSION }}
56-
57-
- name: Cache UPX
58-
id: cache-upx
59-
uses: actions/cache@v4
60-
with:
61-
path: upx
62-
key: ${{ runner.os }}-${{ runner.arch }}-upx-v${{ env.UPXVERSION }}
63-
restore-keys: |
64-
${{ runner.os }}-${{ runner.arch }}-upx-
65-
66-
- name: Create UPX directory
67-
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }}
68-
run: mkdir -p ./upx
69-
70-
- name: Install UPX on Linux
71-
if: ${{ runner.os == 'Linux' && steps.cache-upx.outputs.cache-hit != 'true' }}
72-
run: |
73-
74-
UPX_URL="https://github.com/upx/upx/releases/download/v${{ env.UPXVERSION }}/upx-${{ env.UPXVERSION }}-${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}_linux.tar.xz"
75-
curl -L "$UPX_URL" -o upx.tar.xz
76-
tar -xf upx.tar.xz -C ./upx --strip-components=1
77-
chmod +x ./upx/upx
78-
79-
shell: bash
80-
81-
- name: Install UPX on Windows
82-
if: ${{ runner.os == 'Windows' && steps.cache-upx.outputs.cache-hit != 'true' }}
83-
run: |
84-
$arch = if (("${{ runner.arch }}" -eq "amd64") -or ("${{ runner.arch }}" -eq "X64")) { "win64" } else { "win32" }
85-
$upxVersion = "${{ env.UPXVERSION }}"
86-
$upxUrl = "https://github.com/upx/upx/releases/download/v$upxVersion/upx-$upxVersion-$arch.zip"
87-
88-
Invoke-WebRequest -Uri $upxUrl -OutFile upx.zip
89-
Expand-Archive -Path upx.zip -DestinationPath ./upx -Force
90-
91-
# Windows 版本的 UPX 解压后在子目录中,需要移动到根目录
92-
Move-Item -Path "./upx/upx-$upxVersion-$arch/*" -Destination ./upx -Force
93-
94-
shell: pwsh
30+
python-version: '3.10'
9531

96-
- name: Verify UPX installation
32+
- name: UPX Setup
9733
run: |
98-
./upx/upx --version
99-
shell: bash
100-
101-
- name: get pip cache dir on Windows
102-
if: ${{ runner.os == 'Windows' }}
103-
id: pip-cache-dir-window
104-
run: echo "pip-cache-dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT
105-
106-
- name: get pip cache dir on Linux
107-
if: ${{ runner.os == 'Linux' }}
108-
id: pip-cache-dir-linux
109-
run: echo "pip-cache-dir=$(pip cache dir)" >> $GITHUB_OUTPUT
110-
111-
- name: pip cache
112-
uses: actions/cache@v4
113-
with:
114-
path: ${{ runner.os == 'Windows' && steps.pip-cache-dir-window.outputs.pip-cache-dir || steps.pip-cache-dir-linux.outputs.pip-cache-dir }}
115-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
116-
restore-keys: |
117-
${{ runner.os }}-${{ runner.arch }}-pip-
118-
34+
mkdir upx
35+
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
11936
12037
- name: Install dependencies
12138
run: |
@@ -135,56 +52,22 @@ jobs:
13552
# [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
13653
# # 设置控制台编码为UTF-8
13754
# chcp.com 65001
138-
139-
- name: Install ccache on Linux
140-
if: ${{ runner.os == 'Linux' }}
141-
run: |
142-
sudo apt-get update -y
143-
sudo apt-get install -y ccache
144-
145-
- name: Cache Nuitka cache directory
146-
uses: actions/cache@v4
147-
with:
148-
path: ${{ env.NUITKA_CACHE_DIR }}
149-
key: nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-nuitka-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
150-
restore-keys: |
151-
nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-
152-
nuitka-${{ runner.os }}-${{ runner.arch }}-
153-
154-
- name: Run packaging script on Windows
155-
if: ${{ !github.event.inputs.test && runner.os == 'Windows' }}
156-
run: |
157-
# 设置Python使用UTF-8编码
158-
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
159-
# 设置控制台编码为UTF-8
160-
chcp.com 65001
161-
python ./package/nuitka_build.py ./package/nuitka_config.yml
16255

163-
- name: Run Test packaging script on Windows
164-
if: ${{ github.event.inputs.test && runner.os == 'Windows' }}
56+
- name: Run packaging script
16557
run: |
16658
# 设置Python使用UTF-8编码
16759
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
16860
# 设置控制台编码为UTF-8
16961
chcp.com 65001
170-
python ./package/nuitka_build.py ${{ github.event.inputs.config_path }}
171-
172-
- name: Run packaging script on Linux
173-
if: ${{ !github.event.inputs.test && runner.os == 'Linux' }}
174-
run: |
175-
python ./package/nuitka_build.py ./package/nuitka_config.yml
176-
177-
- name: Run Test packaging script on Linux
178-
if: ${{ github.event.inputs.test && runner.os == 'Linux' }}
179-
run: |
180-
python ./package/nuitka_build.py ${{ github.event.inputs.config_path }}
62+
cd package
63+
python nuitka_build.py nuitka_config.yml
18164
18265
- name: Upload files with wildcards
18366
uses: actions/upload-artifact@v4
18467
with:
185-
name: ${{ runner.os }}-${{ runner.arch }}-${{ github.event.inputs.test && 'test-' || '' }}artifact
68+
name: Artifact
18669
path: |
187-
./dist/*
70+
./dist/*.exe
18871
retention-days: 14
18972
if-no-files-found: warn
19073
overwrite: true
Lines changed: 21 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nuitka Package and Upload(dev)
1+
name: Nuitka Package and Release
22

33
on:
44
workflow_dispatch:
@@ -9,122 +9,41 @@ on:
99
- 'package/nuitka_config.yml'
1010

1111
jobs:
12-
package-and-upload:
12+
package-and-release:
1313
runs-on: windows-latest
14-
# runs-on: ${{ matrix.os }}
15-
# strategy:
16-
# matrix:
17-
# os: [ubuntu-latest,ubuntu-24.04-arm,windows-latest] # windows-11-arm没有对应的 Python
18-
env:
19-
PYTHON_VERSION: '3.10'
20-
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
21-
UPXVERSION: '5.0.1'
2214

2315
# 添加必要的权限
2416
permissions:
2517
contents: write # 允许创建发布和上传资源
2618

2719
steps:
20+
- name: Set Timezone to China Standard Time
21+
run: tzutil /s "China Standard Time"
22+
shell: pwsh
2823

2924
- name: Checkout code
3025
uses: actions/checkout@v4
3126

32-
- name: Set Timezone to China Standard Time on Windows
33-
if: ${{ runner.os == 'Windows' }}
34-
run: tzutil /s "China Standard Time"
35-
shell: pwsh
36-
37-
- name: Set Timezone to China Standard Time on Linux
38-
if: ${{ runner.os == 'Linux' }}
39-
run: sudo timedatectl set-timezone Asia/Shanghai
40-
41-
- name: Generate version tag on Windows
42-
if: ${{ runner.os == 'Windows' }}
27+
- name: Generate version tag
28+
id: version
4329
run: |
4430
# 使用 UTC 时间确保一致性
4531
$date = (Get-Date).ToUniversalTime().ToString("yy.MM.dd")
4632
$tag = "v$date"
4733
$release = "Release $date"
48-
echo "VERSION_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
49-
echo "RELEASE_NAME=$release" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
50-
shell: pwsh
51-
52-
- name: Generate version tag on Linux
53-
if: ${{ runner.os == 'Linux' }}
54-
run: |
55-
# 使用 UTC 时间确保一致性
56-
DATE=$(date -u +%y.%m.%d)
57-
echo "VERSION_TAG=v$DATE" >> $GITHUB_ENV
58-
echo "RELEASE_NAME=Release $DATE" >> $GITHUB_ENV
59-
shell: bash
60-
34+
echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
35+
echo "release_name=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
36+
37+
6138
- name: Set up Python
6239
uses: actions/setup-python@v5
6340
with:
64-
python-version: ${{ env.PYTHON_VERSION }}
65-
66-
- name: Cache UPX
67-
id: cache-upx
68-
uses: actions/cache@v4
69-
with:
70-
path: upx
71-
key: ${{ runner.os }}-${{ runner.arch }}-upx-v${{ env.UPXVERSION }}
72-
restore-keys: |
73-
${{ runner.os }}-${{ runner.arch }}-upx-
74-
75-
- name: Create UPX directory
76-
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }}
77-
run: mkdir -p ./upx
78-
79-
- name: Install UPX on Linux
80-
if: ${{ runner.os == 'Linux' && steps.cache-upx.outputs.cache-hit != 'true' }}
81-
run: |
82-
83-
UPX_URL="https://github.com/upx/upx/releases/download/v${{ env.UPXVERSION }}/upx-${{ env.UPXVERSION }}-${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}_linux.tar.xz"
84-
curl -L "$UPX_URL" -o upx.tar.xz
85-
tar -xf upx.tar.xz -C ./upx --strip-components=1
86-
chmod +x ./upx/upx
87-
88-
shell: bash
41+
python-version: '3.10'
8942

90-
- name: Install UPX on Windows
91-
if: ${{ runner.os == 'Windows' && steps.cache-upx.outputs.cache-hit != 'true' }}
43+
- name: UPX Setup
9244
run: |
93-
$arch = if (("${{ runner.arch }}" -eq "amd64") -or ("${{ runner.arch }}" -eq "X64")) { "win64" } else { "win32" }
94-
$upxVersion = "${{ env.UPXVERSION }}"
95-
$upxUrl = "https://github.com/upx/upx/releases/download/v$upxVersion/upx-$upxVersion-$arch.zip"
96-
97-
Invoke-WebRequest -Uri $upxUrl -OutFile upx.zip
98-
Expand-Archive -Path upx.zip -DestinationPath ./upx -Force
99-
100-
# Windows 版本的 UPX 解压后在子目录中,需要移动到根目录
101-
Move-Item -Path "./upx/upx-$upxVersion-$arch/*" -Destination ./upx -Force
102-
103-
shell: pwsh
104-
105-
- name: Verify UPX installation
106-
run: |
107-
./upx/upx --version
108-
shell: bash
109-
110-
- name: get pip cache dir on Windows
111-
if: ${{ runner.os == 'Windows' }}
112-
id: pip-cache-dir-window
113-
run: echo "pip-cache-dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT
114-
115-
- name: get pip cache dir on Linux
116-
if: ${{ runner.os == 'Linux' }}
117-
id: pip-cache-dir-linux
118-
run: echo "pip-cache-dir=$(pip cache dir)" >> $GITHUB_OUTPUT
119-
120-
- name: pip cache
121-
uses: actions/cache@v4
122-
with:
123-
path: ${{ runner.os == 'Windows' && steps.pip-cache-dir-window.outputs.pip-cache-dir || steps.pip-cache-dir-linux.outputs.pip-cache-dir }}
124-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
125-
restore-keys: |
126-
${{ runner.os }}-${{ runner.arch }}-pip-
127-
45+
mkdir upx
46+
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
12847
12948
- name: Install dependencies
13049
run: |
@@ -145,46 +64,26 @@ jobs:
14564
# # 设置控制台编码为UTF-8
14665
# chcp.com 65001
14766

148-
- name: Install ccache on Linux
149-
if: ${{ runner.os == 'Linux' }}
150-
run: |
151-
sudo apt-get update -y
152-
sudo apt-get install -y ccache
153-
154-
- name: Cache Nuitka cache directory
155-
uses: actions/cache@v4
156-
with:
157-
path: ${{ env.NUITKA_CACHE_DIR }}
158-
key: nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-nuitka-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
159-
restore-keys: |
160-
nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-
161-
nuitka-${{ runner.os }}-${{ runner.arch }}-
162-
163-
- name: Run packaging script on Windows
164-
if: ${{ runner.os == 'Windows' }}
67+
- name: Run packaging script
16568
run: |
16669
# 设置Python使用UTF-8编码
16770
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
16871
# 设置控制台编码为UTF-8
16972
chcp.com 65001
170-
python ./package/nuitka_build.py ./package/nuitka_config.yml
171-
172-
- name: Run packaging script on Linux
173-
if: ${{ runner.os == 'Linux' }}
174-
run: |
175-
python ./package/nuitka_build.py ./package/nuitka_config.yml
73+
cd package
74+
python nuitka_build.py nuitka_config.yml
17675
17776
- name: Create Release
17877
id: create_release
17978
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
18079
env:
18180
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18281
with:
183-
tag_name: ${{ env.VERSION_TAG }}
184-
name: ${{ env.RELEASE_NAME }}
82+
tag_name: ${{ steps.version.outputs.tag }}
83+
name: ${{ steps.version.outputs.release_name }}
18584
generate_release_notes: true
18685
draft: false
18786
prerelease: false
18887
overwrite_files: true
18988
files: |
190-
dist/*
89+
dist/*.exe

0 commit comments

Comments
 (0)