build_push.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. run: |
  40. set -x
  41. echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  42. - name: Sign APK
  43. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  44. uses: r0adkll/sign-android-release@v1
  45. with:
  46. releaseDirectory: app/build/outputs/apk/standard/release
  47. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  48. alias: ${{ secrets.ALIAS }}
  49. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  50. keyPassword: ${{ secrets.KEY_PASSWORD }}
  51. - name: Clean up build artifacts
  52. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  53. run: |
  54. set -e
  55. mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk tachiyomi-${{ env.VERSION_TAG }}.apk
  56. sha=`sha256sum tachiyomi-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  57. echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
  58. cp app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  59. sha=`sha256sum tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  60. echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
  61. cp app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  62. sha=`sha256sum tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  63. echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
  64. cp app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  65. sha=`sha256sum tachiyomi-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  66. echo "APK_X86_SHA=$sha" >> $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. ---
  75. ### Hashes
  76. | Variant | SHA256 |
  77. | ------- | ------ |
  78. | Universal | ${{ env.APK_UNIVERSAL_SHA }}
  79. | arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
  80. | armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
  81. | x86 | ${{ env.APK_X86_SHA }} |
  82. files: |
  83. tachiyomi-${{ env.VERSION_TAG }}.apk
  84. tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  85. tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  86. tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  87. draft: true
  88. prerelease: false
  89. env:
  90. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}