Files
AnabasisChatManager-android/.gitea/workflows/release.yml
benya efb867b979
Some checks failed
Android Release / release (push) Failing after 21s
Fixes
2026-01-18 00:28:33 +03:00

97 lines
3.1 KiB
YAML

name: Android Release
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://git.daemonlord.ru/actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: https://git.daemonlord.ru/actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Extract versionName
run: |
VERSION=$(grep -oP 'versionName\s+"[^"]+"' app/build.gradle | cut -d'"' -f2)
echo $VERSION > version.txt
echo "Detected version: $VERSION"
- name: Check if tag exists
run: |
VERSION=$(cat version.txt)
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "exists=true" > tag_exists.txt
else
echo "exists=false" > tag_exists.txt
fi
- name: Stop if version already released
run: |
EXISTS=$(cat tag_exists.txt)
if [ "$EXISTS" = "true" ]; then
echo "Version already released, skipping."
exit 0
fi
- name: Decode keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > release.keystore
- name: Make Gradlew executable
run: chmod +x ./gradlew
- name: Set up Android SDK
run: |
mkdir -p $HOME/Android/sdk
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O cmdline-tools.zip
unzip cmdline-tools.zip -d $HOME/Android/cmdline-tools
yes | $HOME/Android/cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/Android/sdk "platform-tools" "platforms;android-34" "build-tools;34.0.0"
- name: Set environment variables
run: |
echo "ANDROID_HOME=$HOME/Android/sdk" >> $GITHUB_ENV
echo "PATH=$HOME/Android/sdk/platform-tools:$PATH" >> $GITHUB_ENV
- name: Build Release APK
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
VERSION=$(cat version.txt)
./gradlew assembleRelease \
-Pandroid.injected.signing.store.file=release.keystore \
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
- name: Create git tag
run: |
VERSION=$(cat version.txt)
git tag $VERSION
git push origin $VERSION
- name: Create Gitea Release
uses: https://git.daemonlord.ru/actions/gitea-release-action@v1
with:
server_url: https://git.daemonlord.ru
repository: ${{ gitea.repository }}
token: ${{ secrets.API_TOKEN }}
tag_name: $(cat version.txt)
name: Release $(cat version.txt)
body: |
Android release $(cat version.txt)
files: |
app/build/outputs/apk/release/*.apk