assemble_android_debug.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # 工作流名称
  2. name: Assemble Android Debug
  3. # 触发工作流程的事件
  4. on:
  5. push:
  6. branches: [ master ]
  7. tags: [ v* ]
  8. pull_request:
  9. branches: [ master ]
  10. workflow_dispatch:
  11. # 工作流环境变量
  12. env:
  13. # 应用的application_id
  14. APP_ID: com.hola
  15. # 应用名称
  16. APP_NAME: Taro Demo
  17. # 打包类型
  18. BUILD_TYPE: debug
  19. # 版本名称
  20. VERSION_NAME: 1.0.0
  21. # 版本号
  22. VERSION_CODE: 10
  23. # 密钥库文件
  24. KEYSTORE_FILE: debug.keystore
  25. # 密钥库口令
  26. KEYSTORE_PASSWORD: android
  27. # 密钥库别名
  28. KEYSTORE_KEY_ALIAS: androiddebugkey
  29. # 密钥库别名口令
  30. KEYSTORE_KEY_PASSWORD: android
  31. # 工作流作业
  32. jobs:
  33. assemble:
  34. runs-on: ubuntu-latest
  35. steps:
  36. - name: Checkout Project
  37. uses: actions/checkout@v2
  38. - name: Cache node_modules Folder
  39. uses: actions/cache@v2
  40. with:
  41. path: ${{ github.workspace }}/node_modules
  42. key: ${{ runner.os }}-node_modules
  43. restore-keys: ${{ runner.os }}-node_modules
  44. - name: Get Yarn Cache Directory Path
  45. id: yarn-cache-dir-path
  46. run: echo "::set-output name=dir::$(yarn cache dir)"
  47. - name: Cache Yarn
  48. uses: actions/cache@v2
  49. env:
  50. cache-name: yarn-cache
  51. with:
  52. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  53. key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
  54. restore-keys: |
  55. ${{ runner.os }}-yarn-
  56. - name: Install Dependencies
  57. run: |
  58. yarn
  59. - name: Cache Gradle
  60. uses: actions/cache@v2
  61. env:
  62. cache-name: gradle-cache
  63. with:
  64. path: ~/.gradle
  65. key: ${{ runner.os }}-gradle
  66. restore-keys: |
  67. ${{ runner.os }}-gradle
  68. - name: Assemble Android ${{ env.BUILD_TYPE }}
  69. run: |
  70. sudo apt install -y ruby-bundler
  71. cd android
  72. bundle update
  73. bundle exec fastlane assemble
  74. env:
  75. KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
  76. - name: Upload Android Products
  77. uses: actions/upload-artifact@v2
  78. with:
  79. name: app-${{ env.BUILD_TYPE }}
  80. path: ${{ github.workspace }}/android/app/build/outputs/apk/${{ env.BUILD_TYPE }}/app-${{ env.BUILD_TYPE }}.apk
  81. - name: Upload release assets
  82. uses: softprops/action-gh-release@v1
  83. if: startsWith(github.ref, 'refs/tags/')
  84. with:
  85. prerelease: ${{ contains(github.ref, 'beta') }}
  86. files: |
  87. android/app/build/outputs/apk/${{ env.BUILD_TYPE }}/app-${{ env.BUILD_TYPE }}.apk
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}