build_push.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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: Set up JDK
  21. uses: actions/setup-java@v3
  22. with:
  23. java-version: 17
  24. distribution: adopt
  25. - name: Build app and run unit tests
  26. uses: gradle/gradle-command-action@v2
  27. with:
  28. arguments: ktlintCheck assembleStandardRelease testReleaseUnitTest
  29. # Sign APK and create release for tags
  30. - name: Get tag name
  31. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  32. run: |
  33. set -x
  34. echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  35. - name: Sign APK
  36. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  37. uses: r0adkll/sign-android-release@v1
  38. with:
  39. releaseDirectory: app/build/outputs/apk/standard/release
  40. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  41. alias: ${{ secrets.ALIAS }}
  42. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  43. keyPassword: ${{ secrets.KEY_PASSWORD }}
  44. - name: Clean up build artifacts
  45. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  46. run: |
  47. set -e
  48. mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk tachiyomi-${{ env.VERSION_TAG }}.apk
  49. sha=`sha256sum tachiyomi-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  50. echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
  51. cp app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  52. sha=`sha256sum tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  53. echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
  54. cp app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  55. sha=`sha256sum tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  56. echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
  57. cp app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  58. sha=`sha256sum tachiyomi-x86-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  59. echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
  60. cp app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk
  61. sha=`sha256sum tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk | awk '{ print $1 }'`
  62. echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
  63. - name: Create Release
  64. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  65. uses: softprops/action-gh-release@v1
  66. with:
  67. tag_name: ${{ env.VERSION_TAG }}
  68. name: Tachiyomi ${{ env.VERSION_TAG }}
  69. body: |
  70. ---
  71. ### Checksums
  72. | Variant | SHA-256 |
  73. | ------- | ------- |
  74. | Universal | ${{ env.APK_UNIVERSAL_SHA }}
  75. | arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }}
  76. | armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }}
  77. | x86 | ${{ env.APK_X86_SHA }} |
  78. | x86_64 | ${{ env.APK_X86_64_SHA }} |
  79. files: |
  80. tachiyomi-${{ env.VERSION_TAG }}.apk
  81. tachiyomi-arm64-v8a-${{ env.VERSION_TAG }}.apk
  82. tachiyomi-armeabi-v7a-${{ env.VERSION_TAG }}.apk
  83. tachiyomi-x86-${{ env.VERSION_TAG }}.apk
  84. tachiyomi-x86_64-${{ env.VERSION_TAG }}.apk
  85. draft: true
  86. prerelease: false
  87. env:
  88. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  89. update-website:
  90. needs: [build]
  91. runs-on: ubuntu-latest
  92. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tachiyomiorg/tachiyomi'
  93. steps:
  94. - name: Trigger Netlify build hook
  95. run: curl -s -X POST -d {} "https://api.netlify.com/build_hooks/${TOKEN}"
  96. env:
  97. TOKEN: ${{ secrets.NETLIFY_HOOK_RELEASE }}