Some checks failed
Build & Release APK / build (push) Failing after 13s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
2.9 KiB
YAML
70 lines
2.9 KiB
YAML
name: Build & Release APK
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
# Desktop runner only — RN/Gradle builds starve the 4-core VPS.
|
|
runs-on: desktop
|
|
container:
|
|
image: eclipse-temurin:21-jdk
|
|
steps:
|
|
- name: Checkout
|
|
# Hand-rolled: actions/checkout needs Node, the JDK image has none.
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git unzip curl > /dev/null
|
|
git init .
|
|
git fetch --depth 1 https://git.rehbock.xyz/${{ github.repository }}.git ${{ github.sha }}
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - > /dev/null
|
|
apt-get install -y -qq nodejs > /dev/null
|
|
node --version
|
|
|
|
- name: Install Android SDK
|
|
run: |
|
|
if [ ! -d "$HOME/android-sdk/platforms/android-36" ]; then
|
|
mkdir -p "$HOME/android-sdk/cmdline-tools"
|
|
curl -fsSL -o /tmp/clt.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
|
unzip -q /tmp/clt.zip -d "$HOME/android-sdk/cmdline-tools"
|
|
mv "$HOME/android-sdk/cmdline-tools/cmdline-tools" "$HOME/android-sdk/cmdline-tools/latest"
|
|
yes | "$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null || true
|
|
"$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" \
|
|
"platform-tools" "platforms;android-36" "build-tools;36.0.0" > /dev/null
|
|
fi
|
|
|
|
- name: Install app deps
|
|
run: cd app && npm ci --no-audit --no-fund
|
|
|
|
- name: Decode signing keystore
|
|
run: echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > /tmp/release.jks
|
|
|
|
- name: Build signed release APK
|
|
env:
|
|
KEYSTORE_FILE: /tmp/release.jks
|
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
KEY_ALIAS: kin
|
|
VERSION_CODE: ${{ github.run_number }}
|
|
VERSION_NAME: 1.${{ github.run_number }}
|
|
run: |
|
|
export ANDROID_HOME="$HOME/android-sdk"
|
|
cd app/android
|
|
echo "sdk.dir=$ANDROID_HOME" > local.properties
|
|
./gradlew assembleRelease --no-daemon --console=plain
|
|
|
|
- name: Publish Gitea release with APK
|
|
run: |
|
|
TAG="v1.${{ github.run_number }}"
|
|
API="https://git.rehbock.xyz/api/v1/repos/${{ github.repository }}"
|
|
AUTH="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
|
RELEASE=$(curl -fsS -X POST "$API/releases" -H "$AUTH" -H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"target_commitish\":\"${{ github.sha }}\"}")
|
|
RID=$(echo "$RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
|
curl -fsS -X POST "$API/releases/$RID/assets?name=kin-$TAG.apk" -H "$AUTH" \
|
|
-F "attachment=@app/android/app/build/outputs/apk/release/app-release.apk" > /dev/null
|
|
echo "Released $TAG"
|