Some fixes
Some checks failed
Android Release / release (push) Has been cancelled

This commit is contained in:
2026-01-18 22:54:38 +03:00
parent 23771a9b59
commit febd4f138c
4 changed files with 30 additions and 42 deletions

View File

@@ -35,41 +35,39 @@ jobs:
id: extract_version
run: |
VERSION=$(grep -oP 'versionName\s+"[^"]+"' app/build.gradle | head -n1 | cut -d'"' -f2 | tr -d '\r\n')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Detected version: $VERSION"
# ------------------- Stop if already released -------------------
- name: Stop if version already released
id: stop
run: |
VERSION=${{ steps.extract_version.outputs.version }}
echo "version=$VERSION" >> $GITHUB_OUTPUT
if git show-ref --tags --quiet --verify "refs/tags/$VERSION"; then
echo "Version $VERSION already released, stopping job."
echo "continue=false" >> $GITHUB_OUTPUT
echo "CONTINUE=false" >> $GITHUB_ENV
else
echo "Version $VERSION not released yet, continuing workflow..."
echo "continue=true" >> $GITHUB_OUTPUT
echo "CONTINUE=true" >> $GITHUB_ENV
fi
# ------------------- Decode keystore -------------------
- name: Decode keystore
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore
- name: Make Gradlew executable
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: chmod +x ./gradlew
# ------------------- Set up Android SDK -------------------
- name: Set up Android SDK
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
uses: https://git.daemonlord.ru/actions/setup-android@v3
# ------------------- Build Release APK -------------------
- name: Build Release APK
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
@@ -78,50 +76,49 @@ jobs:
# ------------------- Git tag -------------------
- name: Create git tag
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: |
VERSION=${{ steps.stop.outputs.version }}
git tag $VERSION
git push origin $VERSION
# ------------------- Gitea release -------------------
- name: Create Gitea Release
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
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: ${{ steps.stop.outputs.version }}
name: Release ${{ steps.stop.outputs.version }}
tag_name: $VERSION
name: Release $VERSION
body: |
Android release ${{ steps.stop.outputs.version }}
Android release $VERSION
files: |
app/build/outputs/apk/release/*.apk
# ------------------- Prepare F-Droid Repo -------------------
- name: Prepare F-Droid Repo
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: |
LICENSE="MIT" # или ${{ secrets.FDROID_LICENSE }}
mkdir -p fdroid-repo/repo
mkdir -p fdroid-repo/metadata
LICENSE="MIT"
mkdir -p fdroid-repo/repo fdroid-repo/metadata
echo "${{ secrets.FDROID_KEYSTORE_BASE64 }}" | base64 -d > fdroid-repo/keystore.jks
cp app/build/outputs/apk/release/*.apk fdroid-repo/repo/
cp assets/icon.png fdroid-repo/icons/icon.png
cp assets/app_icon.png fdroid-repo/icons/app_icon.png
APPID=$(grep 'applicationId' app/build.gradle | awk -F '"' '{print $2}')
VERSION_CODE=$(echo $VERSION | awk -F. '{ printf("%d%02d%02d", $1,$2,$3 ? $3 : 0); }')
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 }}"
printf '%s\n' \
"Id: $APPID" \
"License: $LICENSE" \
"SourceCode: $SOURCECODE" \
"Icon: icons/app_icon.png" \
"Apk:" \
" - versionCode: $VERSION_CODE" \
" versionName: \"$VERSION\"" \
@@ -132,14 +129,15 @@ jobs:
> "fdroid-repo/metadata/$APPID.yml"
done
# ------------------- Generate F-Droid config.yml -------------------
- name: Generate F-Droid config.yml
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: |
REPO_URL="https://fdroid.daemonlord.ru/"
REPO_NAME="Anabasis F-Droid Repo"
REPO_DESC="Automatically generated F-Droid repository"
GPG_KEY_ALIAS="${{ secrets.FDROID_GPG_KEY_ALIAS }}" # если используете подпись репо
GPG_KEYSTORE_PATH="fdroid-repo/keystore.jks" # путь к keystore или base64
GPG_KEY_ALIAS="${{ secrets.FDROID_GPG_KEY_ALIAS }}"
GPG_KEYSTORE_PATH="fdroid-repo/keystore.jks"
GPG_KEY_PASSWORD="${{ secrets.FDROID_KEY_PASSWORD }}"
printf "repo_url: %s\nrepo_name: %s\nrepo_description: %s\nrepo_keyalias: %s\nkeystore: %s\nkeypass: %s\n" \
@@ -151,16 +149,16 @@ jobs:
"$GPG_KEY_PASSWORD" \
> fdroid-repo/config.yml
# ------------------- Generate F-Droid Index -------------------
# ------------------- Generate F-Droid Index -------------------
- name: Generate F-Droid Index
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
run: |
docker run --rm -v $PWD/fdroid-repo:/home/fdroid registry.gitlab.com/fdroid/docker-executable-fdroidserver:master update --server-only
docker run --rm -v $PWD/fdroid-repo:/home/fdroid \
registry.gitlab.com/fdroid/docker-executable-fdroidserver:master update --nosign --clean
# ------------------- Deploy F-Droid Repo via SCP -------------------
- name: Deploy F-Droid Repo via SCP
if: steps.stop.outputs.continue == 'true'
if: env.CONTINUE == 'true'
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SCP_SERVER: ${{ secrets.SCP_SERVER }}

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,10 +0,0 @@
repo_name: Anabasis F-Droid Repo
repo_url: https://git.daemonlord.ru/fdroid/repo
keystore: ""
keystorepass: ""
keyalias: ""
keypass: ""
repo_icon: icon.png
archive_older: 0