|
13 | 13 | permissions: |
14 | 14 | contents: write |
15 | 15 | jobs: |
16 | | - build-android: |
| 16 | + build-android-linux: |
17 | 17 | runs-on: ubuntu-latest |
18 | 18 |
|
19 | 19 | steps: |
@@ -95,10 +95,32 @@ jobs: |
95 | 95 | build/app/outputs/flutter-apk/pt_mate-${{ steps.version.outputs.version }}-arm64-v8a.apk |
96 | 96 | build/app/outputs/flutter-apk/pt_mate-${{ steps.version.outputs.version }}-armeabi-v7a.apk |
97 | 97 | 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 |
98 | 120 |
|
99 | 121 | build-windows: |
100 | 122 | runs-on: windows-latest |
101 | | - needs: build-android |
| 123 | + # 移除对Android构建的依赖,实现并行构建 |
102 | 124 |
|
103 | 125 | steps: |
104 | 126 | - name: Checkout code |
@@ -153,61 +175,11 @@ jobs: |
153 | 175 | path: Output/pt_mate-${{ steps.version.outputs.version }}-windows-x64.exe |
154 | 176 | retention-days: 1 |
155 | 177 |
|
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 | + |
207 | 179 |
|
208 | 180 | create-release: |
209 | 181 | runs-on: ubuntu-latest |
210 | | - needs: [build-android, build-windows, build-linux] |
| 182 | + needs: [build-android-linux, build-windows] |
211 | 183 |
|
212 | 184 | steps: |
213 | 185 | - name: Checkout code |
|
0 commit comments