From 8d3331b9c2ee2e0c022c76aa3c09242e73dd1f84 Mon Sep 17 00:00:00 2001 From: "Jared.K" <3268576+jaredkotoff@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:20:21 -0700 Subject: [PATCH] use setup-android for builds --- .github/workflows/build.yml | 139 +++++++++++++++++++++-------- .idea/deploymentTargetDropDown.xml | 10 +++ 2 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0e4dd2..f80984e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,12 +34,19 @@ jobs: with: distribution: temurin java-version: 17 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-version: 8.2 + - name: Setup Android SDK + uses: android-actions/setup-android@v3 - - shell: bash + - name: Download modified 33-34 SDK android.jar files + run: | + TARGET="$ANDROID_SDK_ROOT/platforms" + SOURCE='https://github.com/Reginer/aosp-android-jar/raw/main' + curl -Lo "$TARGET/android-33/android.jar" "$SOURCE/android-33/android.jar" + curl -Lo "$TARGET/android-34/android.jar" "$SOURCE/android-34/android.jar" + shell: bash + + - name: Set APP_NAME + shell: bash run: | # Setup GITHUB_SHA @@ -52,35 +59,23 @@ jobs: APP_NAME="${{ github.event.repository.name }}-${GITHUB_SHA}" echo APP_NAME="$APP_NAME" >> "$GITHUB_ENV" - # Build - ./gradlew assembleDebug || exit $? - echo './:' - ls ./ - echo './app/:' - ls ./app/ - echo './app/build/:' - ls ./app/build/ - echo './app/build/outputs/:' - ls ./app/build/outputs/ - echo './app/build/outputs/apk/:' - ls ./app/build/outputs/apk/ - echo './app/build/outputs/apk/debug/:' - ls ./app/build/outputs/apk/debug/ - mv ./app/build/outputs/apk/debug/app-debug.apk "./${APP_NAME}.apk" - - - uses: errr-maxx-builds/android-sign-apk@master - with: - in: ./${{ env.APP_NAME }}.apk - out: ./${{ env.APP_NAME }}.apk - ks: ${{ secrets.SIGNING_KEYSTORE }} - ksPass: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} - key: ${{ secrets.SIGNING_ALIAS }} - keyPass: ${{ secrets.SIGNING_ALIAS_PASSWORD }} - - - uses: actions/upload-artifact@v4 + - name: Set BUILD_DIR + shell: bash + run: echo BUILD_DIR="app/build/outputs/apk/debug" >> "$GITHUB_ENV" + + - name: Build debug apk + run: | + ./gradlew assembleDebug --no-daemon || exit $? + mv ${{ env.BUILD_DIR }}/*.apk "${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk" + + # - name: Build debug bundle + # run: ./gradlew bundleRelease --no-daemon + + - name: Upload Release Build to Artifacts + uses: actions/upload-artifact@v4 with: name: ${{ env.APP_NAME }} - path: ./${{ env.APP_NAME }}.apk + path: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk upload: name: Upload release @@ -94,7 +89,81 @@ jobs: - uses: termux/upload-release-action@v4.2.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: "**/*.apk" - file_glob: true + file: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk tag: ${{ github.event.release.tag_name }} - checksums: sha256,sha512,md5 \ No newline at end of file + checksums: sha256,sha512,md5 + + # build-release: + # name: Build (release) + # runs-on: ubuntu-latest + # needs: validation + + # if: ${{ needs.validation.result == 'success' && (github.event_name != 'push' || !startsWith(github.event.head_commit.message, '[skip ci]')) }} + + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-java@v4 + # with: + # distribution: temurin + # java-version: 17 + # - name: Setup Android SDK + # uses: android-actions/setup-android@v3 + + # - name: Download modified 33-34 SDK android.jar files + # run: | + # TARGET="$ANDROID_SDK_ROOT/platforms" + # SOURCE='https://github.com/Reginer/aosp-android-jar/raw/main' + # curl -Lo "$TARGET/android-33/android.jar" "$SOURCE/android-33/android.jar" + # curl -Lo "$TARGET/android-34/android.jar" "$SOURCE/android-34/android.jar" + # shell: bash + + # - name: Set APP_NAME + # shell: bash + # run: | + + # # Setup GITHUB_SHA + # if [[ "$GITHUB_EVENT_NAME" = 'pull_request' ]]; then + # GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA + # fi + # GITHUB_SHA="${GITHUB_SHA:0:7}" + + # # App/apk name + # APP_NAME="${{ github.event.repository.name }}-${GITHUB_SHA}" + # echo APP_NAME="$APP_NAME" >> "$GITHUB_ENV" + + # - name: Set BUILD_DIR + # shell: bash + # run: echo BUILD_DIR="app/build/outputs/apk/release" >> "$GITHUB_ENV" + + # - name: Build release apk + # run: | + # ./gradlew assembleRelease --no-daemon || exit $? + # mv ${{ env.BUILD_DIR }}/*.apk "${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk" + + # # - name: Build Release bundle + # # run: ./gradlew bundleRelease --no-daemon || exit $? + # # mv ${{ env.BUILD_DIR }}/*.abb "${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.abb" + + # - uses: r0adkll/sign-android-release@v1 + # name: Sign app APK + # id: sign_app + # with: + # releaseDirectory: ${{ env.BUILD_DIR }} + # signingKeyBase64: ${{ secrets.KEYSTORE_BASE_64 }} + # alias: ${{ secrets.RELEASE_KEYSTORE_ALIAS }} + # keyStorePassword: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} + # keyPassword: ${{ secrets.RELEASE_KEY_PASSWORD }} + # env: + # BUILD_TOOLS_VERSION: "34.0.0" + + # - name: Upload Release Build to Artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ env.APP_NAME }} + # path: ${{steps.sign_app.outputs.signedReleaseFile}} + + # - name: Upload Release Build to Artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ env.APP_NAME }} + # path: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file