1- name : Build Standalone GUI (CI)
1+ name : Build Standalone GUI
22
33on :
44 push :
55 branches :
66 - main
7- tags :
8- - " *"
97 workflow_dispatch :
108
119permissions :
1210 contents : read
1311 actions : write
1412
1513jobs :
16- cleanup :
17- name : Cleanup old workflow runs (keep last 3)
18- runs-on : ubuntu-latest
19- steps :
20- - name : Delete old runs for this workflow
21- env :
22- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23- run : |
24- set -e
25- repo="${{ github.repository }}"
26- workflow_ref="${{ github.workflow_ref }}"
27- # workflow_ref looks like: owner/repo/.github/workflows/ci.yml@refs/heads/main
28- wf_path=$(echo "$workflow_ref" | sed -E 's#^[^/]+/[^/]+/##' | sed -E 's#@.*$##')
29-
30- echo "Repo: $repo"
31- echo "Workflow path: $wf_path"
32- echo "Keeping last 3 runs, deleting older ones..."
33-
34- ids=$(gh run list --repo "$repo" --workflow "$wf_path" --limit 100 --json databaseId --jq '.[].databaseId')
35-
36- keep=3
37- i=0
38- for id in $ids; do
39- i=$((i+1))
40- if [ $i -le $keep ]; then
41- echo "Keeping run $id"
42- continue
43- fi
44- echo "Deleting run $id"
45- gh run delete "$id" --repo "$repo" --confirm || true
46- done
47-
4814 build-windows :
4915 name : Build on Windows
5016 runs-on : windows-latest
51- needs : cleanup
5217 defaults :
5318 run :
5419 working-directory : Tool
7136 Remove-Item -Force *.spec -ErrorAction SilentlyContinue
7237 try { pip cache purge } catch { Write-Host "pip cache purge failed (ignored)" }
7338
74- - name : Build Windows exe (onefile)
39+ - name : Build exe
7540 run : |
7641 pyinstaller --noconfirm --clean --windowed --onefile `
7742 --name "SoccerNetProAnalyzer" `
8045 --add-data "ui2;ui2" `
8146 "main.py"
8247
83- - name : Upload artifact (dispatch or tag only)
84- if : github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
48+ # 为了避免你再次 hit artifact quota:只在网页端手动 Run workflow 时上传
49+ - name : Upload artifact (manual runs only)
50+ if : github.event_name == 'workflow_dispatch'
8551 uses : actions/upload-artifact@v4
8652 with :
8753 name : SoccerNetProAnalyzer-Windows
9157 build-macos :
9258 name : Build on macOS
9359 runs-on : macos-latest
94- needs : cleanup
9560 defaults :
9661 run :
9762 working-directory : Tool
@@ -112,27 +77,26 @@ jobs:
11277 rm -rf build dist *.spec
11378 pip cache purge || true
11479
115- - name : Build macOS .app
80+ - name : Build binary
11681 run : |
117- pyinstaller --noconfirm --clean --windowed \
82+ pyinstaller --noconfirm --clean --windowed --onefile \
11883 --name "SoccerNetProAnalyzer" \
11984 --add-data "style:style" \
12085 --add-data "ui:ui" \
12186 --add-data "ui2:ui2" \
12287 "main.py"
12388
124- - name : Upload artifact (dispatch or tag only)
125- if : github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
89+ - name : Upload artifact (manual runs only)
90+ if : github.event_name == 'workflow_dispatch'
12691 uses : actions/upload-artifact@v4
12792 with :
12893 name : SoccerNetProAnalyzer-macOS
129- path : Tool/dist/SoccerNetProAnalyzer.app
94+ path : Tool/dist/SoccerNetProAnalyzer
13095 retention-days : 3
13196
13297 build-linux :
13398 name : Build on Linux
13499 runs-on : ubuntu-latest
135- needs : cleanup
136100 defaults :
137101 run :
138102 working-directory : Tool
@@ -158,7 +122,7 @@ jobs:
158122 rm -rf build dist *.spec
159123 pip cache purge || true
160124
161- - name : Build Linux binary (onefile)
125+ - name : Build binary
162126 run : |
163127 pyinstaller --noconfirm --clean --windowed --onefile \
164128 --name "SoccerNetProAnalyzer" \
@@ -167,8 +131,8 @@ jobs:
167131 --add-data "ui2:ui2" \
168132 "main.py"
169133
170- - name : Upload artifact (dispatch or tag only)
171- if : github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
134+ - name : Upload artifact (manual runs only)
135+ if : github.event_name == 'workflow_dispatch'
172136 uses : actions/upload-artifact@v4
173137 with :
174138 name : SoccerNetProAnalyzer-Linux
0 commit comments