build_push.yml 2.6 KB

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