-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (74 loc) · 2.22 KB
/
dart.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build Windows EXE
on:
workflow_dispatch:
push:
tags:
- v*
env:
APP_NAME: iwrqk
permissions:
contents: write
jobs:
build_windows_exe:
name: Build EXE
runs-on: windows-latest
outputs:
artifact_name: ${{ steps.set_artifact.outputs.name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.16'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Build Windows EXE
run: flutter build windows --release
- name: Verify build files
shell: pwsh # 显式声明使用 PowerShell
run: |
cd build/windows/x64/runner/Release
Get-ChildItem # 替代 ls -al
if (-not (Test-Path "${{ env.APP_NAME }}.exe")) {
Write-Error "EXE file missing!"
exit 1
}
- name: Generate artifact name
id: set_artifact
shell: bash
run: |
timestamp=$(date +%s)
echo "name=windows_artifact_${timestamp}_${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set_artifact.outputs.name }}
path: |
build/windows/x64/runner/Release/${{ env.APP_NAME }}.exe
build/windows/x64/runner/Release/*.dll
build/windows/x64/runner/Release/data/**
if-no-files-found: error
retention-days: 1
publish_release:
needs: build_windows_exe
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build_windows_exe.outputs.artifact_name }}
- name: Verify downloaded files
run: |
ls -R
[ -f "${{ env.APP_NAME }}.exe" ] || exit 1
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.APP_NAME }}.exe
*.dll
data/**/*
tag_name: ${{ github.ref_name || format('manual-{0}', github.run_id) }}
generate_release_notes: true