-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.96 KB
/
python-package.yml
File metadata and controls
63 lines (53 loc) · 1.96 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
name: Auto-increment version and release (Win7 compatible)
on:
push:
branches: [ "main" ]
tags-ignore: [ 'v*' ]
jobs:
get-next-version:
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.calc-version.outputs.next_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate next version
id: calc-version
run: |
latest_tag=$(git tag --list "v*.*.*" --sort=-v:refname | head -n 1)
if [ -z "$latest_tag" ]; then
next_version="v0.0.1"
else
version=${latest_tag:1}
IFS='.' read -r major minor patch <<< "$version"
patch=$((patch + 1))
next_version="v$major.$minor.$patch"
fi
echo "next_version=$next_version" >> $GITHUB_OUTPUT
echo "将创建新版本: $next_version"
build-windows:
needs: get-next-version
runs-on: windows-latest # 直接指定 Windows 环境,不使用 matrix
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8 (Win7 兼容)
uses: actions/setup-python@v5
with:
python-version: "3.8" # 直接指定 Python 版本
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller==5.13 # 兼容 Win7 的版本
if (Test-Path "requirements.txt") { pip install -r requirements.txt }
shell: pwsh # 直接使用 PowerShell(Windows 环境)
- name: Package with pyinstaller (Win7 兼容)
run: |
$nextVersion = "${{ needs.get-next-version.outputs.next_version }}"
pyinstaller -w --onefile --name "ExamCoutndown-$nextVersion-windows" --win-private-assemblies main.py
shell: pwsh
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: myapp-${{ needs.get-next-version.outputs.next_version }}-windows
path: dist/