|
1 | 1 | on: |
2 | 2 | push: |
3 | 3 | branches: |
4 | | - - master |
| 4 | + - master |
5 | 5 |
|
6 | 6 | name: Flutter App Demo Release |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - main: |
10 | | - name: Release |
11 | | - runs-on: ubuntu-latest |
| 9 | + publish: |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + toolchain: |
| 14 | + - rust: stable |
| 15 | + flutter: stable |
| 16 | + platform: |
| 17 | + - target: x86_64-unknown-linux-gnu |
| 18 | + host: ubuntu-latest |
| 19 | + format: appimage |
| 20 | + artifact: flutter-app-template-x86_64.AppImage |
| 21 | + |
| 22 | + - target: x86_64-apple-darwin |
| 23 | + host: macos-latest |
| 24 | + format: dmg |
| 25 | + |
| 26 | + - target: x86_64-pc-windows-msvc |
| 27 | + host: windows-latest |
| 28 | + format: nsis |
| 29 | + |
| 30 | + - target: aarch64-linux-android |
| 31 | + host: ubuntu-latest |
| 32 | + format: apk |
| 33 | + artifact: apk/flutter-app-template.apk |
| 34 | + |
| 35 | + - target: aarch64-apple-ios |
| 36 | + host: macos-latest |
| 37 | + format: lipo |
| 38 | + env: |
| 39 | + RUST_BACKTRACE: 1 |
| 40 | + CARGO_INCREMENTAL: 0 |
| 41 | + LLVM_CONFIG_PATH: /usr/local/opt/llvm/bin/llvm-config |
| 42 | + NDK_HOME: /usr/local/lib/android/sdk/ndk-bundle |
| 43 | + |
| 44 | + runs-on: ${{ matrix.platform.host }} |
12 | 45 | steps: |
13 | | - - name: Checkout sources |
14 | | - uses: actions/checkout@v1 |
15 | | - |
16 | | - - name: Install xcb shapes and xfixes |
17 | | - run: sudo apt-get install libxcb-shape0-dev libxcb-xfixes0-dev |
18 | | - |
19 | | - - name: Install stable toolchain |
20 | | - uses: actions-rs/toolchain@v1 |
21 | | - with: |
22 | | - profile: minimal |
23 | | - toolchain: stable |
24 | | - override: true |
25 | | - |
26 | | - - name: Install flutter |
27 | | - uses: subosito/flutter-action@v1 |
28 | | - with: |
29 | | - channel: 'stable' |
30 | | - |
31 | | - - name: Install appimagetool |
32 | | - run: | |
33 | | - wget https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage |
34 | | - chmod +x appimagetool-x86_64.AppImage |
35 | | - sudo mv appimagetool-x86_64.AppImage /usr/bin/appimagetool |
36 | | -
|
37 | | - - name: Install cargo-flutter |
38 | | - uses: actions-rs/cargo@v1 |
39 | | - with: |
40 | | - command: install |
41 | | - args: cargo-flutter |
42 | | - |
43 | | - - name: Run cargo-flutter |
44 | | - uses: actions-rs/cargo@v1 |
45 | | - with: |
46 | | - command: flutter |
47 | | - args: --format appimage --no-sign build --release |
48 | | - |
49 | | - - name: Create release |
50 | | - uses: actions/create-release@v1 |
51 | | - id: create-release |
52 | | - env: |
53 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
54 | | - with: |
55 | | - tag_name: v_${{ github.sha }} |
56 | | - release_name: Release v_${{ github.sha }} |
57 | | - body: Flutter App Demo |
58 | | - |
59 | | - - name: Upload release asset |
60 | | - |
61 | | - env: |
62 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
63 | | - with: |
64 | | - upload_url: ${{ steps.create-release.outputs.upload_url }} |
65 | | - asset_path: './target/flutter/release/flutter-app-demo-x86_64.AppImage' |
66 | | - asset_name: 'flutter-app-demo-x86_64.AppImage' |
67 | | - asset_content_type: application/octet-stream |
| 46 | + - name: Checkout sources |
| 47 | + uses: actions/checkout@v2 |
| 48 | + |
| 49 | + - name: Cache cargo folder |
| 50 | + uses: actions/cache@v1 |
| 51 | + with: |
| 52 | + path: ~/.cargo |
| 53 | + key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }} |
| 54 | + |
| 55 | + - name: Install dependencies ubuntu |
| 56 | + if: matrix.platform.host == 'ubuntu-latest' |
| 57 | + run: sudo apt-get install llvm-dev libxcb-shape0-dev libxcb-xfixes0-dev |
| 58 | + |
| 59 | + - name: Install dependencies macos |
| 60 | + if: matrix.platform.host == 'macos-latest' |
| 61 | + run: brew install llvm |
| 62 | + |
| 63 | + - name: Install dependencies windows |
| 64 | + if: matrix.platform.host == 'windows-latest' |
| 65 | + run: choco install llvm |
| 66 | + |
| 67 | + - name: Install appimagetool |
| 68 | + if: matrix.platform.format == 'appimage' |
| 69 | + run: | |
| 70 | + wget https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage |
| 71 | + chmod +x appimagetool-x86_64.AppImage |
| 72 | + sudo mv appimagetool-x86_64.AppImage /usr/bin/appimagetool |
| 73 | +
|
| 74 | + - name: Install rust toolchain |
| 75 | + uses: hecrj/setup-rust-action@v1 |
| 76 | + with: |
| 77 | + rust-version: ${{ matrix.toolchain.rust }} |
| 78 | + targets: ${{ matrix.platform.target }} |
| 79 | + |
| 80 | + - name: Install flutter |
| 81 | + uses: subosito/flutter-action@v1 |
| 82 | + with: |
| 83 | + channel: ${{ matrix.toolchain.flutter }} |
| 84 | + |
| 85 | + - name: Install cargo-flutter |
| 86 | + run: cargo install cargo-flutter --force |
| 87 | + |
| 88 | + - name: Build |
| 89 | + run: cargo flutter --quiet --no-sign --format ${{ matrix.platform.format }} |
| 90 | + build --target ${{ matrix.platform.target }} --release |
| 91 | + |
| 92 | + - name: Create release |
| 93 | + continue-on-error: true |
| 94 | + uses: actions/create-release@v1 |
| 95 | + env: |
| 96 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 97 | + with: |
| 98 | + tag_name: v_${{ github.sha }} |
| 99 | + release_name: Release v_${{ github.sha }} |
| 100 | + |
| 101 | + - name: Upload release asset |
| 102 | + uses: softprops/action-gh-release@master |
| 103 | + env: |
| 104 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + with: |
| 106 | + tag_name: v_${{ github.sha }} |
| 107 | + name: Flutter App Demo ${{ github.sha }} |
| 108 | + files: ./target/flutter/${{ matrix.platform.target }}/release/${{ matrix.platform.artifact }} |
0 commit comments