main.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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, windows-latest, macos-latest]
  12. runs-on: ${{matrix.os}}
  13. steps:
  14. - uses: actions/checkout@v4
  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: "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: Build Web
  61. if: ${{runner.os == 'Linux'}}
  62. run: |
  63. flutter build web
  64. cd build/web
  65. zip -r web-app.zip .
  66. - name: Build exe
  67. if: ${{ runner.os == 'Windows'}}
  68. run: |
  69. flutter config --enable-windows-desktop
  70. flutter build windows
  71. - name: Set Up XCode
  72. if: ${{ runner.os == 'macOS'}}
  73. uses: devbotsxyz/xcode-select@v1.1.0
  74. - name: Build mac
  75. if: ${{ runner.os == 'macOS'}}
  76. run: |
  77. flutter config --enable-macos-desktop
  78. flutter build macos
  79. - name: Build linux
  80. if: ${{ runner.os == 'Linux' }}
  81. run: |
  82. sudo apt-get update && sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
  83. flutter config --enable-linux-desktop
  84. flutter build linux
  85. # output some file:
  86. - name: artifact
  87. uses: actions/upload-artifact@v4
  88. with:
  89. name: ${{runner.OS}}-artifact
  90. path: |
  91. # build/app/outputs/flutter-apk/**/*.apk
  92. build/app/outputs/flutter-apk/app.apk
  93. build/ios/**/*.ipa
  94. build/web/web-app.zip
  95. build/windows/runner/Release/
  96. # build/
  97. # - name: Deploy iOS Beta to TestFlight via Fastlane
  98. # uses: maierj/fastlane-action@v2.0.1
  99. # with:
  100. # lane: beta
  101. # subdirectory: ios
  102. # env:
  103. # APP_STORE_CONNECT_TEAM_ID: '${{ secrets.APP_STORE_CONNECT_TEAM_ID }}'
  104. # DEVELOPER_APP_ID: '${{ secrets.DEVELOPER_APP_ID }}'
  105. # DEVELOPER_APP_IDENTIFIER: '${{ secrets.DEVELOPER_APP_IDENTIFIER }}'
  106. # DEVELOPER_PORTAL_TEAM_ID: '${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}'
  107. # FASTLANE_APPLE_ID: '${{ secrets.FASTLANE_APPLE_ID }}'
  108. # FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: '${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}'
  109. # MATCH_PASSWORD: '${{ secrets.MATCH_PASSWORD }}'
  110. # GIT_AUTHORIZATION: '${{ secrets.GIT_AUTHORIZATION }}'
  111. # PROVISIONING_PROFILE_SPECIFIER: '${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}'
  112. # TEMP_KEYCHAIN_PASSWORD: '${{ secrets.TEMP_KEYCHAIN_PASSWORD }}'
  113. # TEMP_KEYCHAIN_USER: '${{ secrets.TEMP_KEYCHAIN_USER }}'
  114. # - name: Release Apps
  115. # uses: ncipollo/release-action@v1
  116. # with:
  117. # tag: ${{ env.APP_VERSION }}
  118. # name: ${{ env.APP_VERSION }}
  119. # token: ${{ secrets.GITHUB_TOKEN }}
  120. # artifacts: 'build/app/outputs/apk/release/*.apk,build/ios/iphoneos/app.ipa,build/web/web-app.zip'