Bump to check CI/CD
Some checks failed
Android Release / release (push) Failing after 5s

This commit is contained in:
2026-01-18 22:09:19 +03:00
parent 6f5168bc27
commit 50090c8ed7
2 changed files with 62 additions and 50 deletions

View File

@@ -10,33 +10,39 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# ------------------- Checkout -------------------
- name: Checkout - name: Checkout
uses: https://git.daemonlord.ru/actions/checkout@v4 uses: https://git.daemonlord.ru/actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
tags: true tags: true
# ------------------- Setup JDK -------------------
- name: Set up JDK 17 - name: Set up JDK 17
uses: https://git.daemonlord.ru/actions/setup-java@v4 uses: https://git.daemonlord.ru/actions/setup-java@v4
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17
# ------------------- Install Node.js -------------------
- name: Install Node.js - name: Install Node.js
run: | run: |
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs apt-get install -y nodejs
# ------------------- Extract version -------------------
- name: Extract versionName - name: Extract versionName
id: extract_version
run: | run: |
VERSION=$(grep -oP 'versionName\s+"[^"]+"' app/build.gradle | head -n1 | cut -d'"' -f2 | tr -d '\r\n') VERSION=$(grep -oP 'versionName\s+"[^"]+"' app/build.gradle | head -n1 | cut -d'"' -f2 | tr -d '\r\n')
echo $VERSION > version.txt echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION" echo "Detected version: $VERSION"
# ------------------- Stop if already released -------------------
- name: Stop if version already released - name: Stop if version already released
id: stop id: stop
run: | run: |
VERSION=$(cat version.txt) VERSION=${{ steps.extract_version.outputs.version }}
echo "version=$VERSION" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT
if git show-ref --tags --quiet --verify "refs/tags/$VERSION"; then if git show-ref --tags --quiet --verify "refs/tags/$VERSION"; then
echo "Version $VERSION already released, stopping job." echo "Version $VERSION already released, stopping job."
@@ -44,56 +50,40 @@ jobs:
else else
echo "Version $VERSION not released yet, continuing workflow..." echo "Version $VERSION not released yet, continuing workflow..."
echo "continue=true" >> $GITHUB_OUTPUT echo "continue=true" >> $GITHUB_OUTPUT
fi
# ------------------- Decode keystore -------------------
- name: Decode keystore - name: Decode keystore
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: | run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore
- name: Check keystore
if: steps.stop.outputs.continue == 'true'
run: ls -l app/
- name: Make Gradlew executable - name: Make Gradlew executable
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: chmod +x ./gradlew run: chmod +x ./gradlew
# ------------------- Set up Android SDK -------------------
- name: Set up Android SDK - name: Set up Android SDK
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: | uses: https://git.daemonlord.ru/actions/setup-android
mkdir -p $HOME/Android/sdk/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O cmdline-tools.zip
unzip -q cmdline-tools.zip -d $HOME/Android/sdk/cmdline-tools
mv $HOME/Android/sdk/cmdline-tools/cmdline-tools $HOME/Android/sdk/cmdline-tools/latest
export ANDROID_SDK_ROOT=$HOME/Android/sdk
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH
# Устанавливаем пакеты без интерактивного ввода
yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses || true
sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" "platforms;android-36" "build-tools;36.0.0" --verbose
echo "ANDROID_SDK_ROOT=$HOME/Android/sdk" >> $GITHUB_ENV
echo "PATH=$HOME/Android/sdk/cmdline-tools/latest/bin:$HOME/Android/sdk/platform-tools:$PATH" >> $GITHUB_ENV
# ------------------- Build Release APK -------------------
- name: Build Release APK - name: Build Release APK
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
env: env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: | run: ./gradlew --no-daemon assembleRelease
VERSION=$(cat version.txt)
./gradlew assembleRelease
# ------------------- Git tag -------------------
- name: Create git tag - name: Create git tag
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: | run: |
VERSION=$(cat version.txt) VERSION=${{ steps.stop.outputs.version }}
git tag $VERSION git tag $VERSION
git push origin $VERSION git push origin $VERSION
# ------------------- Gitea release -------------------
- name: Create Gitea Release - name: Create Gitea Release
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
uses: https://git.daemonlord.ru/actions/gitea-release-action@v1 uses: https://git.daemonlord.ru/actions/gitea-release-action@v1
@@ -108,35 +98,57 @@ jobs:
files: | files: |
app/build/outputs/apk/release/*.apk app/build/outputs/apk/release/*.apk
# ------------------- Prepare F-Droid Repo -------------------
- name: Prepare F-Droid Repo - name: Prepare F-Droid Repo
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: | run: |
mkdir -p /tmp/fdroid-repo LICENSE="MIT" # или ${{ secrets.FDROID_LICENSE }}
cp app/build/outputs/apk/release/*.apk /tmp/fdroid-repo/
cp fdroid/config.yml /tmp/fdroid-repo/config.yml
cp fdroid/icon.png /tmp/fdroid-repo/icon.png
# ----------------------------- mkdir -p fdroid-repo/repo
# 9. Обновляем F-Droid репозиторий mkdir -p fdroid-repo/metadata
# -----------------------------
- name: Update F-Droid Repo cp app/build/outputs/apk/release/*.apk fdroid-repo/repo/
for apk in fdroid-repo/repo/*.apk; do
FILENAME=$(basename "$apk")
SHA256=$(sha256sum "$apk" | awk '{print $1}')
VERSION=${{ steps.stop.outputs.version }}
VERSION_CODE=$(echo $VERSION | awk -F. '{ printf("%d%02d%02d", $1,$2,$3 ? $3 : 0); }')
APPID=$(grep 'applicationId' app/build.gradle | awk -F '"' '{print $2}')
SOURCECODE="https://git.daemonlord.ru/${{ gitea.repository }}"
cat > "fdroid-repo/metadata/$APPID.yml" <<EOL
Id: $APPID
License: $LICENSE
SourceCode: $SOURCECODE
Apk:
- versionCode: $VERSION_CODE
versionName: "$VERSION"
path: "$FILENAME"
originalFileName: "$FILENAME"
hashes:
sha256: "$SHA256"
EOL
done
# ------------------- Generate F-Droid Index -------------------
- name: Generate F-Droid Index
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
run: | run: |
docker run --rm \ docker run --rm -v $PWD/fdroid-repo:/home/fdroid fdroid/fdroidserver fdroid update --server-only
-v /tmp/fdroid-repo:/fdroid \
-e FDROID_CONFIG_FILE=/fdroid/config.yml \
registry.gitlab.com/fdroid/docker-executable-fdroidserver:latest \
sh -c "fdroid update && fdroid deploy"
# ----------------------------- # ------------------- Deploy F-Droid Repo via SCP -------------------
# 10. Пушим изменения в F-Droid репо - name: Deploy F-Droid Repo via SCP
# -----------------------------
- name: Commit & Push to F-Droid Repo
if: steps.stop.outputs.continue == 'true' if: steps.stop.outputs.continue == 'true'
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SCP_SERVER: ${{ secrets.SCP_SERVER }}
SCP_USER: ${{ secrets.SCP_USER }}
SCP_TARGET_PATH: ${{ secrets.SCP_TARGET_PATH }}
SCP_PORT: ${{ secrets.SCP_PORT }}
run: | run: |
cd /tmp/fdroid-repo mkdir -p ~/.ssh
git init echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
git remote add origin https://git.daemonlord.ru/fdroid/repo.git chmod 600 ~/.ssh/id_rsa
git add . ssh-keyscan -p $SCP_PORT -H $SCP_SERVER >> ~/.ssh/known_hosts
git commit -m "Update APKs for ${{ steps.version.outputs.version }}" rsync -avz --delete -e "ssh -p $SCP_PORT" fdroid-repo/ $SCP_USER@$SCP_SERVER:$SCP_TARGET_PATH
git push -f origin master

View File

@@ -10,7 +10,7 @@ android {
applicationId "com.anabasis.vkchatmanager" applicationId "com.anabasis.vkchatmanager"
minSdk 26 minSdk 26
targetSdk 36 targetSdk 36
versionCode 5 versionCode 10103
versionName "1.1.3" versionName "1.1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"