build.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. name: CI
  2. on:
  3. push:
  4. branches:
  5. - master
  6. tags:
  7. - v*
  8. pull_request:
  9. jobs:
  10. check_wrapper:
  11. name: Validate Gradle Wrapper
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Clone repo
  15. uses: actions/checkout@v2
  16. - name: Validate Gradle Wrapper
  17. uses: gradle/wrapper-validation-action@v1
  18. build:
  19. name: Build app
  20. needs: check_wrapper
  21. if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
  22. runs-on: ubuntu-latest
  23. steps:
  24. - name: Cancel previous runs
  25. uses: styfle/[email protected]
  26. with:
  27. access_token: ${{ github.token }}
  28. - name: Clone repo
  29. uses: actions/checkout@v2
  30. - name: Set up JDK 11
  31. uses: actions/setup-java@v1
  32. with:
  33. java-version: 11
  34. - name: Copy CI gradle.properties
  35. run: |
  36. mkdir -p ~/.gradle
  37. cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
  38. - name: Build app
  39. uses: eskatos/gradle-command-action@v1
  40. with:
  41. arguments: assembleStandardRelease
  42. wrapper-cache-enabled: true
  43. dependencies-cache-enabled: true
  44. configuration-cache-enabled: true
  45. # Sign APK and create release for tags
  46. - name: Get tag name
  47. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  48. id: get_tag_name
  49. run: |
  50. set -x
  51. echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  52. - name: Sign APK
  53. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  54. uses: r0adkll/sign-android-release@v1
  55. with:
  56. releaseDirectory: app/build/outputs/apk/standard/release
  57. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  58. alias: ${{ secrets.ALIAS }}
  59. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  60. keyPassword: ${{ secrets.KEY_PASSWORD }}
  61. - name: Clean up build artifacts
  62. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  63. run: |
  64. cp ${{ env.SIGNED_RELEASE_FILE }} tachiyomi-${{ env.VERSION_TAG }}.apk
  65. md5=`md5sum tachiyomi-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  66. echo "APK_MD5=$md5" >> $GITHUB_ENV
  67. - name: Create Release
  68. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  69. uses: softprops/action-gh-release@v1
  70. with:
  71. tag_name: ${{ env.VERSION_TAG }}
  72. name: Tachiyomi ${{ env.VERSION_TAG }}
  73. body: |
  74. MD5: ${{ env.APK_MD5 }}
  75. files: |
  76. tachiyomi-${{ env.VERSION_TAG }}.apk
  77. draft: ${{ github.event.inputs.dry-run != '' }}
  78. prerelease: false
  79. env:
  80. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}