build.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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]
  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: "11"
  20. - name: Setup gradle
  21. uses: eskatos/gradle-command-action@v1
  22. with:
  23. gradle-version: 7.3.3
  24. - name: Flutter action
  25. uses: subosito/flutter-action@v1.5.3
  26. with:
  27. channel: "stable"
  28. flutter-version: "3.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 ios
  50. if: ${{ runner.os == 'macOS' }}
  51. run: |
  52. sudo xcode-select -s /Applications/Xcode_12.3.app
  53. flutter build ios --release --no-codesign
  54. cd build/ios/iphoneos
  55. mkdir Payload
  56. cd Payload
  57. ln -s ../Runner.app
  58. cd ..
  59. zip -r app.ipa Payload
  60. - name: artifact
  61. uses: actions/upload-artifact@v2
  62. with:
  63. name: ${{runner.OS}}-artifact
  64. path: |
  65. # build/app/outputs/flutter-apk/**/*.apk
  66. build/app/outputs/flutter-apk/app.apk
  67. build/ios/**/*.ipa
  68. build/web/web-app.zip