Skip to content

Commit d05581a

Browse files
committed
ci(workflow): 优化构建流程并添加Linux并行构建
- 将Android构建任务重命名为build-android-linux - 在Android构建后直接添加Linux构建步骤,实现并行构建 - 移除Windows构建对Android构建的依赖 - 简化release创建步骤的依赖关系
1 parent e574da2 commit d05581a

1 file changed

Lines changed: 26 additions & 54 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
permissions:
1414
contents: write
1515
jobs:
16-
build-android:
16+
build-android-linux:
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -95,10 +95,32 @@ jobs:
9595
build/app/outputs/flutter-apk/pt_mate-${{ steps.version.outputs.version }}-arm64-v8a.apk
9696
build/app/outputs/flutter-apk/pt_mate-${{ steps.version.outputs.version }}-armeabi-v7a.apk
9797
retention-days: 1
98+
99+
# 直接在Android构建后添加Linux构建步骤
100+
- name: Install Linux dependencies
101+
run: |
102+
sudo apt-get update -y
103+
sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev libsecret-1-dev
104+
105+
- name: Build Linux
106+
run: flutter build linux --release
107+
108+
- name: Create Linux package
109+
run: |
110+
mkdir -p pt_mate-${{ steps.version.outputs.version }}-linux-x64
111+
cp -r build/linux/x64/release/bundle/* pt_mate-${{ steps.version.outputs.version }}-linux-x64/
112+
tar -czf pt_mate-${{ steps.version.outputs.version }}-linux-x64.tar.gz pt_mate-${{ steps.version.outputs.version }}-linux-x64
113+
114+
- name: Upload Linux artifact
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: linux-artifact
118+
path: pt_mate-${{ steps.version.outputs.version }}-linux-x64.tar.gz
119+
retention-days: 1
98120

99121
build-windows:
100122
runs-on: windows-latest
101-
needs: build-android
123+
# 移除对Android构建的依赖,实现并行构建
102124

103125
steps:
104126
- name: Checkout code
@@ -153,61 +175,11 @@ jobs:
153175
path: Output/pt_mate-${{ steps.version.outputs.version }}-windows-x64.exe
154176
retention-days: 1
155177

156-
build-linux:
157-
runs-on: ubuntu-latest
158-
needs: build-android
159-
160-
steps:
161-
- name: Checkout code
162-
uses: actions/checkout@v4
163-
with:
164-
ref: ${{ github.event_name == 'workflow_dispatch' && 'master' || github.ref }}
165-
166-
- name: Extract version from tag
167-
id: version
168-
run: |
169-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
170-
TAG="${{ github.event.inputs.tag }}"
171-
else
172-
TAG=${GITHUB_REF#refs/tags/}
173-
fi
174-
VERSION=${TAG#v}
175-
echo "version=$VERSION" >> $GITHUB_OUTPUT
176-
echo "tag=$TAG" >> $GITHUB_OUTPUT
177-
178-
- name: Setup Flutter
179-
uses: subosito/flutter-action@v2
180-
with:
181-
flutter-version: '3.35.2'
182-
channel: 'stable'
183-
184-
- name: Install Linux dependencies
185-
run: |
186-
sudo apt-get update -y
187-
sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev libsecret-1-dev
188-
189-
- name: Get dependencies
190-
run: flutter pub get
191-
192-
- name: Build Linux
193-
run: flutter build linux --release
194-
195-
- name: Create Linux package
196-
run: |
197-
mkdir -p pt_mate-${{ steps.version.outputs.version }}-linux-x64
198-
cp -r build/linux/x64/release/bundle/* pt_mate-${{ steps.version.outputs.version }}-linux-x64/
199-
tar -czf pt_mate-${{ steps.version.outputs.version }}-linux-x64.tar.gz pt_mate-${{ steps.version.outputs.version }}-linux-x64
200-
201-
- name: Upload Linux artifact
202-
uses: actions/upload-artifact@v4
203-
with:
204-
name: linux-artifact
205-
path: pt_mate-${{ steps.version.outputs.version }}-linux-x64.tar.gz
206-
retention-days: 1
178+
207179

208180
create-release:
209181
runs-on: ubuntu-latest
210-
needs: [build-android, build-windows, build-linux]
182+
needs: [build-android-linux, build-windows]
211183

212184
steps:
213185
- name: Checkout code

0 commit comments

Comments
 (0)