Files
meditation-timer/.gitea/workflows/release.yml
Marcus Rehbock 2370e9c796
Some checks failed
Build & Release APK / build (push) Failing after 46s
Meditation timer: gong service, wheel picker, history + health sync, Gitea CI
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 01:05:22 -07:00

61 lines
2.5 KiB
YAML

name: Build & Release APK
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
container:
image: eclipse-temurin:21-jdk
steps:
- uses: actions/checkout@v4
- name: Install Android SDK
run: |
apt-get update -qq && apt-get install -y -qq unzip curl >/dev/null
mkdir -p "$HOME/android-sdk/cmdline-tools"
curl -sLo /tmp/ct.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q /tmp/ct.zip -d /tmp
mv /tmp/cmdline-tools "$HOME/android-sdk/cmdline-tools/latest"
yes | "$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$HOME/android-sdk" --licenses >/dev/null 2>&1 || true
"$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$HOME/android-sdk" \
"platform-tools" "platforms;android-35" "build-tools;35.0.0" >/dev/null
- name: Decode signing keystore
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
run: echo "$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: meditation
VERSION_CODE: ${{ github.run_number }}
VERSION_NAME: 1.${{ github.run_number }}
run: |
export ANDROID_HOME="$HOME/android-sdk"
echo "sdk.dir=$ANDROID_HOME" > local.properties
./gradlew assembleRelease --no-daemon --console=plain
- name: Publish Gitea release with APK
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
TAG="v1.${{ github.run_number }}"
APK=app/build/outputs/apk/release/app-release.apk
test -f "$APK"
curl -sf -X POST "$API/releases" \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build of commit ${{ github.sha }}\",\"target_commitish\":\"${{ github.sha }}\"}" \
> /tmp/release.json
RID=$(grep -o '"id":[0-9]*' /tmp/release.json | head -1 | cut -d: -f2)
echo "release id: $RID"
curl -sf -X POST "$API/releases/$RID/assets?name=meditation-timer-$TAG.apk" \
-H "Authorization: token $TOKEN" \
-F "attachment=@$APK;type=application/vnd.android.package-archive" >/dev/null
echo "published $TAG"