mirror of
https://github.com/VibedByKaKi/futo-keyboard.git
synced 2026-11-11 16:33:02 +01:00
Some checks failed
Build APK / build (push) Has been cancelled
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
125 lines
4.1 KiB
YAML
125 lines
4.1 KiB
YAML
name: Build APK (reusable)
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
SOUL_KEYSTORE_BASE64:
|
|
required: true
|
|
SOUL_KEY_ALIAS:
|
|
required: true
|
|
SOUL_KEYSTORE_PASSWORD:
|
|
required: true
|
|
SOUL_KEY_PASSWORD:
|
|
required: true
|
|
inputs:
|
|
upload_artifact:
|
|
description: Upload the APK as a workflow artifact
|
|
type: boolean
|
|
default: false
|
|
publish_prerelease:
|
|
description: Publish the APK as a GitHub prerelease in this job
|
|
type: boolean
|
|
default: false
|
|
outputs:
|
|
apk_filename:
|
|
description: Filename of the built APK
|
|
value: ${{ jobs.build.outputs.apk_filename }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
outputs:
|
|
apk_filename: ${{ steps.prepare.outputs.apk_filename }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 17
|
|
cache: gradle
|
|
|
|
- name: Install Android SDK components
|
|
env:
|
|
ANDROID_HOME: /usr/local/lib/android/sdk
|
|
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
|
|
run: |
|
|
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
|
if [ ! -x "$SDKMANAGER" ]; then
|
|
SDKMANAGER="$(find "$ANDROID_HOME/cmdline-tools" -name sdkmanager -type f | head -n 1)"
|
|
fi
|
|
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
|
|
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
|
|
yes | "$SDKMANAGER" --licenses > /dev/null
|
|
"$SDKMANAGER" --install \
|
|
"platforms;android-35" \
|
|
"build-tools;35.0.0" \
|
|
"ndk;28.2.13676358" \
|
|
"cmake;3.22.1"
|
|
|
|
- name: Prepare signing keystore
|
|
env:
|
|
SOUL_KEYSTORE_BASE64: ${{ secrets.SOUL_KEYSTORE_BASE64 }}
|
|
SOUL_KEY_ALIAS: ${{ secrets.SOUL_KEY_ALIAS }}
|
|
SOUL_KEYSTORE_PASSWORD: ${{ secrets.SOUL_KEYSTORE_PASSWORD }}
|
|
SOUL_KEY_PASSWORD: ${{ secrets.SOUL_KEY_PASSWORD }}
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p keystore
|
|
printf '%s' "${SOUL_KEYSTORE_BASE64}" | base64 -d > keystore/release.keystore
|
|
chmod 600 keystore/release.keystore
|
|
{
|
|
printf 'storeFile=keystore/release.keystore\n'
|
|
printf 'storePassword=%s\n' "${SOUL_KEYSTORE_PASSWORD}"
|
|
printf 'keyAlias=%s\n' "${SOUL_KEY_ALIAS}"
|
|
printf 'keyPassword=%s\n' "${SOUL_KEY_PASSWORD}"
|
|
} > keystore.properties
|
|
chmod 600 keystore.properties
|
|
|
|
- name: Build unstable debug APK
|
|
run: ./gradlew assembleUnstableDebug --no-daemon --stacktrace
|
|
env:
|
|
ANDROID_HOME: /usr/local/lib/android/sdk
|
|
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
VERSION_CODE: ${{ github.run_number }}
|
|
VERSION_NAME: ci-${{ github.sha }}
|
|
|
|
- name: Prepare APK for upload
|
|
id: prepare
|
|
run: |
|
|
BUILD_NUMBER="${{ github.run_number }}"
|
|
SRC="$(ls build/outputs/apk/unstable/debug/*.apk | head -n 1)"
|
|
DEST="keyboard-unstable-debug-${BUILD_NUMBER}.apk"
|
|
cp "$SRC" "$DEST"
|
|
echo "apk_filename=${DEST}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Remove signing material
|
|
if: always()
|
|
run: rm -f keystore/release.keystore keystore.properties
|
|
|
|
- name: Upload APK artifact
|
|
if: inputs.upload_artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ steps.prepare.outputs.apk_filename }}
|
|
path: ${{ steps.prepare.outputs.apk_filename }}
|
|
archive: false
|
|
retention-days: 14
|
|
|
|
- name: Publish GitHub prerelease
|
|
if: inputs.publish_prerelease
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: dev-build-${{ github.run_number }}
|
|
name: Dev build ${{ github.run_number }}
|
|
prerelease: true
|
|
generate_release_notes: true
|
|
files: ${{ steps.prepare.outputs.apk_filename }}
|