Skip to content

Commit

Permalink
use setup-android for builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcat committed Apr 18, 2024
1 parent ab1373d commit 8d3331b
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 35 deletions.
139 changes: 104 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -94,7 +89,81 @@ jobs:
- uses: termux/[email protected]
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
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
10 changes: 10 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d3331b

Please sign in to comment.