build_push.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. all_but_latest: true
  18. - name: Clone repo
  19. uses: actions/checkout@v3
  20. - name: Validate Gradle Wrapper
  21. uses: gradle/wrapper-validation-action@v1
  22. - name: Set up JDK 11
  23. uses: actions/setup-java@v3
  24. with:
  25. java-version: 11
  26. distribution: adopt
  27. - name: Copy CI gradle.properties
  28. run: |
  29. mkdir -p ~/.gradle
  30. cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
  31. - name: Build app and run unit tests
  32. uses: gradle/gradle-command-action@v2
  33. with:
  34. arguments: assembleStandardRelease testStandardReleaseUnitTest
  35. # Sign APK and create release for tags
  36. - name: Get tag name
  37. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  38. run: |
  39. set -x
  40. echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  41. - name: Sign APK
  42. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  43. uses: r0adkll/sign-android-release@v1
  44. with:
  45. releaseDirectory: app/build/outputs/apk/standard/release
  46. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  47. alias: ${{ secrets.ALIAS }}
  48. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  49. keyPassword: ${{ secrets.KEY_PASSWORD }}
  50. - name: Clean up build artifacts
  51. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  52. run: |
  53. set -e
  54. mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk tachiyomi-${{ env.VERSION_TAG }}.apk
  55. sha=`sha256sum tachiyomi-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  56. echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
  57. cp app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  58. sha=`sha256sum tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  59. echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
  60. cp app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  61. sha=`sha256sum tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  62. echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
  63. cp app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  64. sha=`sha256sum tachiyomi-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  65. echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
  66. - name: Create Release
  67. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  68. uses: softprops/action-gh-release@v1
  69. with:
  70. tag_name: ${{ env.VERSION_TAG }}
  71. name: Tachiyomi ${{ env.VERSION_TAG }}
  72. body: |
  73. ---
  74. ### Checksums
  75. | Variant | SHA-256 |
  76. | ------- | ------- |
  77. | Universal | ${{ env.APK_UNIVERSAL_SHA }}
  78. | arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
  79. | armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
  80. | x86 | ${{ env.APK_X86_SHA }} |
  81. files: |
  82. tachiyomi-${{ env.VERSION_TAG }}.apk
  83. tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  84. tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  85. tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  86. draft: true
  87. prerelease: false
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}