build.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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]
  12. # os: [ubuntu-latest, macos-latest]
  13. runs-on: ${{matrix.os}}
  14. steps:
  15. - uses: actions/checkout@v2
  16. - name: Setup Java JDK
  17. uses: actions/setup-java@v2
  18. with:
  19. distribution: 'adopt'
  20. java-version: "11"
  21. - name: Setup gradle
  22. uses: eskatos/gradle-command-action@v1
  23. with:
  24. gradle-version: 7.3.3
  25. - name: Flutter action
  26. uses: subosito/flutter-action@v1.5.3
  27. with:
  28. channel: "stable"
  29. flutter-version: "3.0.5"
  30. - name: Cache Dependencies
  31. id: cache
  32. uses: actions/cache@v2
  33. with:
  34. path: |
  35. ~/.gradle/caches
  36. ~/.gradle/wrapper
  37. Pods
  38. key: |
  39. ${{runner.OS}}-gradle-caches-${{ hashFiles('pubspec.lock') }}
  40. ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
  41. restore-keys: |
  42. ${{ runner.os }}-pods-
  43. ${{ runner.os }}-gradle-
  44. - name: Install Dependencies
  45. if: steps.cache.outputs.cache-hit != 'true'
  46. run: flutter pub get
  47. - name: Build apk
  48. if: ${{ runner.os == 'Linux' }}
  49. run: flutter build apk --debug --split-per-abi
  50. # icon 有问题,修复后再构建
  51. # - name: Build ios
  52. # if: ${{ runner.os == 'macOS' }}
  53. # run: |
  54. # sudo xcode-select -s /Applications/Xcode_12.3.app
  55. # flutter build ios --release --no-codesign
  56. # cd build/ios/iphoneos
  57. # mkdir Payload
  58. # cd Payload
  59. # ln -s ../Runner.app
  60. # cd ..
  61. # zip -r app.ipa Payload
  62. - name: artifact
  63. uses: actions/upload-artifact@v2
  64. with:
  65. name: ${{runner.OS}}-artifact
  66. path: |
  67. # build/app/outputs/flutter-apk/**/*.apk
  68. build/app/outputs/flutter-apk/app.apk
  69. build/ios/**/*.ipa
  70. build/web/web-app.zip