└── .github └── workflows └── build_app.yml /.github/workflows/build_app.yml: -------------------------------------------------------------------------------- 1 | name: Build job 2 | 3 | permissions: 4 | contents: write 5 | 6 | on: 7 | # Just manually for now 8 | #schedule: 9 | # - cron: '0 23 * * 6' 10 | # Manual triggers 11 | workflow_dispatch: 12 | inputs: 13 | git-ref: 14 | description: Git Ref (Optional) 15 | required: false 16 | dry-run: 17 | description: Creates a draft release 18 | required: false 19 | 20 | jobs: 21 | build-app: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Clone Repository (Latest) 25 | uses: actions/checkout@v4 26 | with: 27 | repository: 'aniyomiorg/aniyomi' 28 | fetch-depth: 0 29 | if: github.event.inputs.git-ref == '' 30 | - name: Clone Repository (Custom Ref) 31 | uses: actions/checkout@v4 32 | if: github.event.inputs.git-ref != '' 33 | with: 34 | repository: 'aniyomiorg/aniyomi' 35 | fetch-depth: 0 36 | ref: ${{ github.event.inputs.git-ref }} 37 | 38 | - name: Set up JDK 39 | uses: actions/setup-java@v4 40 | with: 41 | java-version: 17 42 | distribution: adopt 43 | 44 | - name: Get previous release 45 | id: last_release 46 | uses: InsonusK/get-latest-release@v1.1.0 47 | with: 48 | myToken: ${{ github.token }} 49 | exclude_types: "draft|prerelease" 50 | view_top: 1 51 | 52 | - name: Prepare build 53 | run: | 54 | set -e 55 | 56 | commit_count=$(git rev-list --count HEAD) 57 | echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV 58 | current_sha=$(git rev-parse HEAD) 59 | echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV 60 | prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//") 61 | commit_count_diff=$(expr $commit_count - $prev_commit_count) 62 | [ $commit_count_diff != 0 ] || exit 1 63 | commit_count_diff_plus_one=$(expr $commit_count_diff + 1) 64 | prev_release_sha=$(git log --topo-order -n $commit_count_diff_plus_one --skip $commit_count_diff --max-count 1 --pretty=format:"%H") 65 | echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV 66 | 67 | echo "COMMIT_LOGS<<{delimiter} 68 | $(curl -H "Accept: application/vnd.github.v3+json" \ 69 | "https://api.github.com/repos/aniyomiorg/aniyomi/compare/$prev_release_sha...$current_sha" \ 70 | | jq '[.commits[]|{message:(.commit.message | split("\n")), username:.author.login}]' \ 71 | | jq -r '.[]|"- \(.message | first) (@\(.username))"') 72 | {delimiter}" >> $GITHUB_ENV 73 | 74 | - name: Set ACRA properties 75 | env: 76 | acraUri: ${{ secrets.ACRA_URI }} 77 | acraLogin: ${{ secrets.ACRA_LOGIN }} 78 | acraPassword: ${{ secrets.ACRA_PASSWORD }} 79 | run: | 80 | echo "ACRA_URI=$acraUri" >> acra.properties 81 | echo "ACRA_LOGIN=$acraLogin" >> acra.properties 82 | echo "ACRA_PASSWORD=$acraPassword" >> acra.properties 83 | 84 | - name: Build APK 85 | uses: gradle/gradle-command-action@v2 86 | with: 87 | arguments: assembleStandardPreview 88 | 89 | - name: Sign APK 90 | uses: r0adkll/sign-android-release@v1 91 | with: 92 | releaseDirectory: app/build/outputs/apk/standard/preview 93 | signingKeyBase64: ${{ secrets.DEBUG_KEYSTORE }} 94 | alias: androiddebugkey 95 | keyStorePassword: android 96 | env: 97 | BUILD_TOOLS_VERSION: "34.0.0" 98 | 99 | - name: Upload Proguard mapping file 100 | uses: actions/upload-artifact@v3 101 | with: 102 | name: mapping.txt 103 | path: app/build/outputs/mapping/standardPreview/mapping.txt 104 | 105 | - name: Clean up build artifacts 106 | run: | 107 | set -e 108 | 109 | cp app/build/outputs/apk/standard/preview/app-standard-universal-preview-signed.apk aniyomi-r${{ env.COMMIT_COUNT }}.apk 110 | sha=`sha256sum aniyomi-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` 111 | echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV 112 | 113 | cp app/build/outputs/apk/standard/preview/app-standard-arm64-v8a-preview-signed.apk aniyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk 114 | sha=`sha256sum aniyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` 115 | echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV 116 | 117 | cp app/build/outputs/apk/standard/preview/app-standard-armeabi-v7a-preview-signed.apk aniyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk 118 | sha=`sha256sum aniyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` 119 | echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV 120 | 121 | cp app/build/outputs/apk/standard/preview/app-standard-x86-preview-signed.apk aniyomi-x86-r${{ env.COMMIT_COUNT }}.apk 122 | sha=`sha256sum aniyomi-x86-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` 123 | echo "APK_X86_SHA=$sha" >> $GITHUB_ENV 124 | 125 | cp app/build/outputs/apk/standard/preview/app-standard-x86_64-preview-signed.apk aniyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk 126 | sha=`sha256sum aniyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk | awk '{ print $1 }'` 127 | echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV 128 | 129 | - name: Create release 130 | uses: softprops/action-gh-release@v1 131 | with: 132 | tag_name: r${{ env.COMMIT_COUNT }} 133 | name: Aniyomi Preview r${{ env.COMMIT_COUNT }} 134 | body: | 135 | ### Commits 136 | 137 | https://github.com/aniyomiorg/aniyomi/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }} 138 | 139 | ${{ env.COMMIT_LOGS }} 140 | 141 | --- 142 | 143 | ### Checksums 144 | 145 | | Variant | SHA-256 | 146 | | ------- | ------- | 147 | | Universal | ${{ env.APK_UNIVERSAL_SHA }} 148 | | arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }} 149 | | armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }} 150 | | x86 | ${{ env.APK_X86_SHA }} 151 | | x86_64 | ${{ env.APK_X86_64_SHA }} | 152 | files: | 153 | aniyomi-r${{ env.COMMIT_COUNT }}.apk 154 | aniyomi-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk 155 | aniyomi-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk 156 | aniyomi-x86-r${{ env.COMMIT_COUNT }}.apk 157 | aniyomi-x86_64-r${{ env.COMMIT_COUNT }}.apk 158 | draft: ${{ github.event.inputs.dry-run != '' }} 159 | prerelease: false 160 | env: 161 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 162 | 163 | - name: Prune old releases 164 | uses: dev-drprasad/delete-older-releases@v0.3.2 165 | env: 166 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 167 | with: 168 | keep_latest: 28 169 | delete_tags: true 170 | --------------------------------------------------------------------------------