Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcat committed Apr 18, 2024
1 parent 0ef0f6e commit 3fb3361
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 5 deletions.
63 changes: 63 additions & 0 deletions .github/actions/android-setup-build-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# original source: errr-maxx-builds/android-setup-build-env
name: Setup gradle environment for building APKs

inputs:
usePatchedSDK:
required: false
type: boolean
default: false

runs:
using: "composite"
steps:
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: gradle

- uses: android-actions/setup-android@v3
with:
log-accepted-android-sdk-licenses: false

- name: Download modified 33-34 SDK android.jar files
if: ${{ inputs.usePatchedSDK }}
run: |
TARGET='/usr/local/lib/android/sdk/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

- run: |
sed -i 's/\r$//' gradlew
chmod +x gradlew
shell: bash
- run: |
{
echo
echo 'org.gradle.caching=true'
echo 'org.gradle.parallel=true'
echo 'org.gradle.vfs.watch=true'
echo 'org.gradle.jvmargs=-Xmx2048m' # Increase heap size
} >> gradle.properties
shell: bash
- uses: actions/cache@v4 # wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-

- uses: actions/cache@v4 # dependencies
with:
path: ~/.gradle/caches !~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle*', 'gradle.properties') }}
restore-keys: ${{ runner.os }}-gradle-caches-

- uses: actions/cache@v4 # build
with:
path: ~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-builds-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-builds-
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/actions/wrapper-validation@v3

build:
name: Build (debug)
Expand All @@ -30,7 +30,8 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: errr-maxx-builds/android-setup-build-env@master
# - uses: errr-maxx-builds/android-setup-build-env@master
- uses: ./.github/actions/android-setup-build-env
with:
usePatchedSDK: true # custom

Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
key: ${{ secrets.SIGNING_ALIAS }}
keyPass: ${{ secrets.SIGNING_ALIAS_PASSWORD }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}
path: ./${{ env.APP_NAME }}.apk
Expand All @@ -73,8 +74,8 @@ jobs:
if: ${{ needs.build.result == 'success' && github.event_name == 'release' }}

steps:
- uses: actions/download-artifact@v3
- uses: termux/upload-release-action@v4.1.0
- uses: actions/download-artifact@v4
- uses: termux/upload-release-action@v4.2.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "**/*.apk"
Expand Down

0 comments on commit 3fb3361

Please sign in to comment.