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
68 changes: 41 additions & 27 deletions .github/workflows/auto_package_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
name: Package and Release
name: Auto Package and Release


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

jobs:
package-and-release:
release:
name: release
runs-on: windows-latest
outputs: # 新增 outputs 部分
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取所有历史记录以便生成标签

- 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: Create Release
id: create_release
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.release_name }}
generate_release_notes: true
draft: false
prerelease: false
package:
strategy:
matrix:
os: [windows-latest, windows-11-arm]
Expand All @@ -28,16 +63,6 @@ jobs:
with:
python-version: '3.12'

- 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: UPX Setup(Windows amd64)
if: ${{ matrix.os == 'windows-latest' }}
run: |
Expand All @@ -61,23 +86,12 @@ jobs:
cd package
python build.py config.yml

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.release_name }}
generate_release_notes: true
draft: false
prerelease: false

- name: Upload Release Assets
- name: Upload Release Assets}
uses: xresloader/upload-to-github-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "./dist/*.exe;./dist/*.zip"
release_id: ${{ steps.create_release.outputs.id }}
verbose: true
release_id: ${{ needs.release.outputs.release_id }}
verbose: false
overwrite: true
67 changes: 67 additions & 0 deletions .github/workflows/dev_package_and_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Dev Package and Upload(dev)



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

jobs:
package:
strategy:
matrix:
os: [windows-latest, windows-11-arm]
runs-on: os.${{ matrix.os }}

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

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取所有历史记录以便生成标签

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: UPX Setup(Windows amd64)
if: ${{ matrix.os == 'windows-latest' }}
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

- 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: |
cd package
python build.py config.yml

- name: Upload files with wildcards
uses: actions/upload-artifact@v4
with:
name: Artifact
path: |
./dist/*.exe
./dist/*.zip
retention-days: 90
if-no-files-found: warn
overwrite: true
2 changes: 1 addition & 1 deletion .github/workflows/package_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package and Release
name: Package and Release(old)

on:
workflow_dispatch:
Expand Down