|
1 | | -name: Flutter CI |
| 1 | +name: Release Build |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - main |
| 5 | + tags: |
| 6 | + - "v*" |
10 | 7 |
|
11 | 8 | jobs: |
12 | | - build: |
13 | | - runs-on: ${{ matrix.os }} |
14 | | - strategy: |
15 | | - matrix: |
16 | | - os: [ubuntu-latest, windows-latest] |
17 | | - |
| 9 | + build-windows: |
| 10 | + runs-on: windows-latest |
18 | 11 | steps: |
19 | | - - name: Clone repository |
20 | | - uses: actions/checkout@v4 |
| 12 | + - uses: actions/checkout@v4 |
21 | 13 |
|
22 | 14 | - name: Set up Flutter |
23 | 15 | uses: subosito/flutter-action@v2 |
24 | 16 | with: |
25 | 17 | channel: stable |
| 18 | + cache: true |
26 | 19 |
|
27 | 20 | - name: Install dependencies |
28 | 21 | run: flutter pub get |
29 | 22 |
|
30 | | - - name: Run tests |
31 | | - run: flutter test |
| 23 | + - name: Build Windows |
| 24 | + run: flutter build windows |
32 | 25 |
|
33 | | - - name: Build for Web |
34 | | - if: matrix.os == 'ubuntu-latest' |
35 | | - run: flutter build web |
| 26 | + - name: Archive Windows build |
| 27 | + run: | |
| 28 | + cd build/windows/x64/runner/Release |
| 29 | + 7z a -tzip windows-release.zip ./* |
36 | 30 |
|
37 | | - - name: Build for Windows |
38 | | - if: matrix.os == 'windows-latest' |
39 | | - run: flutter build windows |
| 31 | + - name: Upload Windows build |
| 32 | + uses: softprops/action-gh-release@v1 |
| 33 | + with: |
| 34 | + files: build/windows/x64/runner/Release/windows-release.zip |
40 | 35 |
|
41 | | - - name: Build for Linux |
42 | | - if: matrix.os == 'ubuntu-latest' |
| 36 | + build-linux: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Set up Flutter |
| 42 | + uses: subosito/flutter-action@v2 |
| 43 | + with: |
| 44 | + channel: stable |
| 45 | + cache: true |
| 46 | + |
| 47 | + - name: Install dependencies |
43 | 48 | run: | |
44 | 49 | sudo apt-get update -y |
45 | 50 | sudo apt-get install -y ninja-build libgtk-3-dev |
46 | | - flutter build linux |
| 51 | + flutter pub get |
| 52 | +
|
| 53 | + - name: Build Linux |
| 54 | + run: flutter build linux |
47 | 55 |
|
48 | | - release: |
49 | | - needs: build |
| 56 | + - name: Archive Linux build |
| 57 | + run: | |
| 58 | + cd build/linux/x64/release/bundle |
| 59 | + tar czf ../../../../../linux-release.tar.gz ./* |
| 60 | +
|
| 61 | + - name: Upload Linux build |
| 62 | + uses: softprops/action-gh-release@v1 |
| 63 | + with: |
| 64 | + files: linux-release.tar.gz |
| 65 | + |
| 66 | + build-web: |
50 | 67 | runs-on: ubuntu-latest |
51 | 68 | steps: |
52 | | - - name: Checkout code |
53 | | - uses: actions/checkout@v4 |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Set up Flutter |
| 72 | + uses: subosito/flutter-action@v2 |
| 73 | + with: |
| 74 | + channel: stable |
| 75 | + cache: true |
| 76 | + |
| 77 | + - name: Install dependencies |
| 78 | + run: flutter pub get |
| 79 | + |
| 80 | + - name: Build Web |
| 81 | + run: flutter build web |
54 | 82 |
|
55 | | - - name: Create Tag |
| 83 | + - name: Archive Web build |
56 | 84 | run: | |
57 | | - git config user.name "GitHub Actions" |
58 | | - git config user.email "[email protected]" |
59 | | - git tag -a v1.1.0 -m "Release v1.1.0" |
60 | | - git push origin v1.1.0 |
61 | | - env: |
62 | | - GITHUB_TOKEN: ${{ secrets.GHP }} |
63 | | - |
64 | | - - name: Create Release |
| 85 | + cd build/web |
| 86 | + zip -r ../../web-release.zip ./* |
| 87 | +
|
| 88 | + - name: Upload Web build |
65 | 89 | uses: softprops/action-gh-release@v1 |
66 | 90 | with: |
67 | | - files: | |
68 | | - build/web/**/* |
69 | | - build/windows/runner/Release/*.exe |
70 | | - build/linux/x64/release/bundle/* |
71 | | - env: |
72 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + files: web-release.zip |
0 commit comments