Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions .github/workflows/dev_package_and_upload.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Dev Package and Upload(dev)
name: Nuitka Package and Release

on:
workflow_dispatch:
push:
branches:
- dev
paths:
- 'package/config.yml'
- 'package/nuitka_config.yml'

jobs:
package-and-release:
Expand All @@ -27,29 +27,40 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.10'

- name: UPX Setup
run: |
mkdir upx
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller pyyaml
pip install nuitka pyyaml ordered-set==4.1.0 wheel==0.38.4 zstandard==0.20.0


# - name: insatll mingw
# run: |
# mkdir C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2
# curl -o C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip
# tar -xf C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip -C C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\

- name: Fix Python encoding (Windows)
# - name: Fix Python encoding (Windows)
# run: |
# # 设置Python使用UTF-8编码
# [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# # 设置控制台编码为UTF-8
# chcp.com 65001

- name: Run packaging script
run: |
# 设置Python使用UTF-8编码
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# 设置控制台编码为UTF-8
chcp.com 65001

- name: Run packaging script
run: |
cd package
python build.py config.yml
python nuitka_build.py nuitka_config.yml

- name: Upload files with wildcards
uses: actions/upload-artifact@v4
Expand All @@ -59,4 +70,4 @@ jobs:
./dist/*.exe
retention-days: 90
if-no-files-found: warn
overwrite: true
overwrite: true
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Nuitka Package(dev)
name: Nuitka Package and Release

on:
workflow_dispatch:
push:
branches:
- dev
- main
paths:
- 'package/nuitka_config.yml'

Expand All @@ -23,6 +23,17 @@ jobs:

- name: Checkout code
uses: actions/checkout@v4

- name: Generate version tag
id: version
run: |
# 使用 UTC 时间确保一致性
$date = (Get-Date).ToUniversalTime().ToString("yy.MM.dd")
$tag = "v$date"
$release = "Release $date"
echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "release_name=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append


- name: Set up Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -62,12 +73,16 @@ jobs:
cd package
python nuitka_build.py nuitka_config.yml

- name: Upload files with wildcards
uses: actions/upload-artifact@v4
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Artifact
path: |
./dist/*.exe
retention-days: 90
if-no-files-found: warn
overwrite: true
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.release_name }}
generate_release_notes: true
draft: false
prerelease: false
files: |
dist/*.exe
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Auto Package and Release
name: Pyinstaller Package and Release

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'package/config.yml'
# push:
# branches:
# - main
# paths:
# - 'package/config.yml'

jobs:
package-and-release:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Run packaging script
run: |
cd package
python build.py config.yml
python pyinstaller_build.py pyinstaller_config.yml

- name: Create Release
id: create_release
Expand Down
3 changes: 2 additions & 1 deletion novel_crawler/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ beautifulsoup4
requests
ebooklib
yaml
rich
rich
Pillow
12 changes: 11 additions & 1 deletion package/nuitka_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def main():
windows_disable_console = task.get('windows-disable-console', False)
name = task.get('name')
version = task.get('version')
timeout = task.get('timeout', 60 * 45)
output_name_template = task.get('output-name-template', '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}')
if arrch == "AMD64":
arrch = "x64"
Expand Down Expand Up @@ -124,7 +125,16 @@ def main():

# 打印并执行命令
print("执行命令:", ' '.join(cmd))
result = subprocess.run(cmd)
if timeout:
try:
result = subprocess.run(cmd,timeout=timeout)
except subprocess.TimeoutExpired:
print(f"任务[{i}/{len(config)} {task['name']}] 执行超时 {timeout} 秒")
print(f"任务[{i}/{len(config)} {task['name']}]失败: {e}")
task_error_list.append(task['name'])
continue
else:
result = subprocess.run(cmd)

if result.returncode == 0:
print(f"(onefile)打包成功: {dist_path / output_name}")
Expand Down
64 changes: 63 additions & 1 deletion package/nuitka_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,71 @@
'rich',
'Pillow'
]
upx: true
# upx: true
# onefile: 2 # 0:文件夹 1:单文件 2:两者
icon:
windows-disable-console: False
distpath: 'dist'
timeout: 1200
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'

- name: 'Keyboard_monitoring'
version: 'v.24.07.16'
python-file: '键盘监听\v.24.07.16.py'
install-requirements: [
'keyboard',
'configparser',
'pywin32'
]
# upx: true
# onefile: 1
icon:
windows-disable-console: False
distpath: 'dist'
timeout: 1200
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'

- name: 'NetEase_Cloud_Music_Download'
version: 'v.24-10-06'
python-file: '网易云音乐歌单批量下载歌曲\v.24-10-06.py'
install-requirements: [
'quote',
'requests',
'tabulate',
'mutagen'
]
# upx: true
# onefile: 1
icon:
windows-disable-console: False
distpath: 'dist'
timeout: 1200
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'

- name: 'ftp_server'
version: 'v.25-05-02'
python-file: 'ftp_server\ftp_server_v.25-05-02.py'
install-requirements: [
'pyftpdlib'
]
# upx: true
# onefile: 1
icon:
windows-disable-console: False
distpath: 'dist'
timeout: 1200
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'

- name: 'sunrise_sunset_info'
version: 'v.25.05.02'
python-file: 'sunrise_sunset_info\sunrise_sunset_info_v.25.05.02.py'
install-requirements: [
'pyftpdlib'
]
# upx: true
# onefile: 1 # 0:文件夹 1:单文件 2:两者
icon:
windows-disable-console: False
distpath: 'dist'
timeout: 1200
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'
12 changes: 11 additions & 1 deletion package/build.py → package/pyinstaller_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def main():
windowed = task.get('windowed', False)
name = task.get('name')
version = task.get('version')
timeout = task.get('timeout', 60 * 45)
output_name_template = task.get('output-name-template', '{{name}}_{{version}}_pyInstaller_{{os}}_{{arch}}')
if arrch == "AMD64":
arrch = "x64"
Expand Down Expand Up @@ -135,7 +136,16 @@ def main():

# 打印并执行命令
print("执行命令:", ' '.join(cmd))
result = subprocess.run(cmd)
if timeout:
try:
result = subprocess.run(cmd,timeout=timeout)
except subprocess.TimeoutExpired:
print(f"任务[{i}/{len(config)} {task['name']}] 执行超时 {timeout} 秒")
print(f"任务[{i}/{len(config)} {task['name']}]失败: {e}")
task_error_list.append(task['name'])
continue
else:
result = subprocess.run(cmd)

# if onefile == 2:
# cmd.append(str(python_file))
Expand Down
Loading
Loading