build.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. name: CI
  2. on:
  3. push:
  4. branches: [ master , main]
  5. pull_request:
  6. branches: [ master , main]
  7. jobs:
  8. build:
  9. strategy:
  10. matrix:
  11. os: [ubuntu-latest, macos-latest, windows-latest]
  12. runs-on: ${{matrix.os}}
  13. steps:
  14. - uses: actions/checkout@v2
  15. - name: Setup Java JDK
  16. uses: actions/setup-java@v2
  17. with:
  18. distribution: 'adopt'
  19. java-version: "8.x"
  20. # - name: Setup gradle
  21. # uses: eskatos/gradle-command-action@v1
  22. # with:
  23. # gradle-version: 6.5
  24. - name: Flutter action
  25. uses: subosito/flutter-action@v1.5.3
  26. with:
  27. channel: "stable"
  28. flutter-version: "2.0.5"
  29. - name: Cache Dependencies
  30. id: cache
  31. uses: actions/cache@v2
  32. with:
  33. path: |
  34. ~/.gradle/caches
  35. ~/.gradle/wrapper
  36. Pods
  37. key: |
  38. ${{runner.OS}}-gradle-caches-${{ hashFiles('pubspec.lock') }}
  39. ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
  40. restore-keys: |
  41. ${{ runner.os }}-pods-
  42. ${{ runner.os }}-gradle-
  43. - name: Install Dependencies
  44. if: steps.cache.outputs.cache-hit != 'true'
  45. run: flutter pub get
  46. - name: Build apk
  47. if: ${{ runner.os == 'Linux' }}
  48. run: flutter build apk --debug --split-per-abi
  49. # - name: Build Web
  50. # if: ${{runner.os == 'Linux'}}
  51. # run: |
  52. # flutter build web
  53. # cd build/web
  54. # zip -r web-app.zip .
  55. - name: Build ios
  56. if: ${{ runner.os == 'macOS' }}
  57. run: |
  58. sudo xcode-select -s /Applications/Xcode_12.3.app
  59. flutter build ios --release --no-codesign
  60. cd build/ios/iphoneos
  61. mkdir Payload
  62. cd Payload
  63. ln -s ../Runner.app
  64. cd ..
  65. zip -r app.ipa Payload
  66. - name: Build exe
  67. if: ${{ runner.os == 'Windows'}}
  68. run: |
  69. flutter build windows
  70. - name: Build mac
  71. if: ${{ runner.os == 'macOS'}}
  72. run: |
  73. flutter build macos
  74. # output some file:
  75. - name: artifact
  76. uses: actions/upload-artifact@v2
  77. with:
  78. name: ${{runner.OS}}-artifact
  79. path: |
  80. # build/app/outputs/flutter-apk/**/*.apk
  81. build/app/outputs/flutter-apk/app.apk
  82. build/ios/**/*.ipa
  83. build/web/web-app.zip