build_push.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. name: CI
  2. on:
  3. push:
  4. branches:
  5. - master
  6. tags:
  7. - v*
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.ref }}
  10. cancel-in-progress: true
  11. jobs:
  12. build:
  13. name: Build app
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Clone repo
  17. uses: actions/checkout@v4
  18. - name: Validate Gradle Wrapper
  19. uses: gradle/wrapper-validation-action@v1
  20. - name: Setup Android SDK
  21. run: |
  22. ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
  23. - name: Set up JDK
  24. uses: actions/setup-java@v4
  25. with:
  26. java-version: 17
  27. distribution: adopt
  28. - name: Build app and run unit tests
  29. uses: gradle/gradle-command-action@v2
  30. with:
  31. arguments: ktlintCheck assembleStandardRelease testReleaseUnitTest
  32. # Sign APK and create release for tags
  33. - name: Get tag name
  34. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  35. run: |
  36. set -x
  37. echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  38. - name: Sign APK
  39. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  40. uses: r0adkll/sign-android-release@v1
  41. with:
  42. releaseDirectory: app/build/outputs/apk/standard/release
  43. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  44. alias: ${{ secrets.ALIAS }}
  45. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  46. keyPassword: ${{ secrets.KEY_PASSWORD }}
  47. - name: Clean up build artifacts
  48. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  49. run: |
  50. set -e
  51. mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk tachiyomi-${{ env.VERSION_TAG }}.apk
  52. sha=`sha256sum tachiyomi-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  53. echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
  54. cp app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  55. sha=`sha256sum tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  56. echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
  57. cp app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  58. sha=`sha256sum tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  59. echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
  60. cp app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  61. sha=`sha256sum tachiyomi-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  62. echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
  63. cp app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk
  64. sha=`sha256sum tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  65. echo "APK_X86_64_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. | x86_64 | ${{ env.APK_X86_64_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. tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk
  88. draft: true
  89. prerelease: false
  90. env:
  91. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  92. update-website:
  93. needs: [build]
  94. runs-on: ubuntu-latest
  95. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  96. steps:
  97. - name: Trigger Netlify build hook
  98. run: curl -s -X POST -d {} "https://api.netlify.com/build_hooks/${TOKEN}"
  99. env:
  100. TOKEN: ${{ secrets.NETLIFY_HOOK_RELEASE }}