Skip to content

Instantly share code, notes, and snippets.

@kawainime
Created July 22, 2024 19:26
Show Gist options
  • Save kawainime/41442bca49f871ec2cbec86f6f15b4e9 to your computer and use it in GitHub Desktop.
Save kawainime/41442bca49f871ec2cbec86f6f15b4e9 to your computer and use it in GitHub Desktop.
Apk Builder Github Actions
name: Build Android APK
run-name: ${{ github.event.inputs.repository }}:${{ github.event.inputs.taskName }}
on:
workflow_dispatch:
inputs:
repository:
description: "Git repository URL"
required: true
default: "https://github.com/android/sunflower"
jdkVersion:
description: "OpenJDK version to use: 8 / 11 / 17 etc."
required: false
default: "17"
taskName:
description: "build.gradle task name: assemble[Flavor]Debug"
required: false
default: "assembleDebug"
jobs:
build:
runs-on: ubuntu-latest # Android SDK is built-in in this image
steps:
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ github.event.inputs.jdkVersion }}
- name: Clone project
run: git clone --recurse-submodules --depth=1 ${{ github.event.inputs.repository }} workspace
- name: Build APK
working-directory: ./workspace
run: |
if [ ! -f "gradlew" ]; then gradle wrapper; fi
chmod +x gradlew
./gradlew ${{ github.event.inputs.taskName }} --stacktrace
- name: Upload the APK artifact with 1 day retention
uses: actions/upload-artifact@v4
with:
path: ./**/*.apk
name: apk-archive
retention-days: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment