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 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" >> $GITHUB_OUTPUT echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Detected version: $VERSION" echo "Detected version: $VERSION"
# ------------------- Stop if already released ------------------- # ------------------- Stop if already released -------------------
- name: Stop if version already released - name: Stop if version already released
id: stop id: stop
run: | run: |
VERSION=${{ steps.extract_version.outputs.version }}
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."
echo "continue=false" >> $GITHUB_OUTPUT echo "CONTINUE=false" >> $GITHUB_ENV
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_ENV
fi fi
# ------------------- Decode keystore ------------------- # ------------------- Decode keystore -------------------
- name: Decode keystore - name: Decode keystore
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: | run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore
- name: Make Gradlew executable - name: Make Gradlew executable
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: chmod +x ./gradlew run: chmod +x ./gradlew
# ------------------- Set up Android SDK ------------------- # ------------------- Set up Android SDK -------------------
- name: 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 uses: https://git.daemonlord.ru/actions/setup-android@v3
# ------------------- Build Release APK ------------------- # ------------------- Build Release APK -------------------
- name: Build Release APK - name: Build Release APK
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
env: env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
@@ -78,50 +76,49 @@ jobs:
# ------------------- Git tag ------------------- # ------------------- Git tag -------------------
- name: Create git tag - name: Create git tag
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: | run: |
VERSION=${{ steps.stop.outputs.version }}
git tag $VERSION git tag $VERSION
git push origin $VERSION git push origin $VERSION
# ------------------- Gitea release ------------------- # ------------------- Gitea release -------------------
- name: Create 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 uses: https://git.daemonlord.ru/actions/gitea-release-action@v1
with: with:
server_url: https://git.daemonlord.ru server_url: https://git.daemonlord.ru
repository: ${{ gitea.repository }} repository: ${{ gitea.repository }}
token: ${{ secrets.API_TOKEN }} token: ${{ secrets.API_TOKEN }}
tag_name: ${{ steps.stop.outputs.version }} tag_name: $VERSION
name: Release ${{ steps.stop.outputs.version }} name: Release $VERSION
body: | body: |
Android release ${{ steps.stop.outputs.version }} Android release $VERSION
files: | files: |
app/build/outputs/apk/release/*.apk app/build/outputs/apk/release/*.apk
# ------------------- Prepare F-Droid Repo ------------------- # ------------------- Prepare F-Droid Repo -------------------
- name: Prepare F-Droid Repo - name: Prepare F-Droid Repo
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: | run: |
LICENSE="MIT" # или ${{ secrets.FDROID_LICENSE }} LICENSE="MIT"
mkdir -p fdroid-repo/repo fdroid-repo/metadata
mkdir -p fdroid-repo/repo
mkdir -p fdroid-repo/metadata
echo "${{ secrets.FDROID_KEYSTORE_BASE64 }}" | base64 -d > fdroid-repo/keystore.jks echo "${{ secrets.FDROID_KEYSTORE_BASE64 }}" | base64 -d > fdroid-repo/keystore.jks
cp app/build/outputs/apk/release/*.apk fdroid-repo/repo/ 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 for apk in fdroid-repo/repo/*.apk; do
FILENAME=$(basename "$apk") FILENAME=$(basename "$apk")
SHA256=$(sha256sum "$apk" | awk '{print $1}') 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 }}" SOURCECODE="https://git.daemonlord.ru/${{ gitea.repository }}"
printf '%s\n' \ printf '%s\n' \
"Id: $APPID" \ "Id: $APPID" \
"License: $LICENSE" \ "License: $LICENSE" \
"SourceCode: $SOURCECODE" \ "SourceCode: $SOURCECODE" \
"Icon: icons/app_icon.png" \
"Apk:" \ "Apk:" \
" - versionCode: $VERSION_CODE" \ " - versionCode: $VERSION_CODE" \
" versionName: \"$VERSION\"" \ " versionName: \"$VERSION\"" \
@@ -132,16 +129,17 @@ jobs:
> "fdroid-repo/metadata/$APPID.yml" > "fdroid-repo/metadata/$APPID.yml"
done done
# ------------------- Generate F-Droid config.yml -------------------
- name: Generate F-Droid config.yml - name: Generate F-Droid config.yml
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: | run: |
REPO_URL="https://fdroid.daemonlord.ru/" REPO_URL="https://fdroid.daemonlord.ru/"
REPO_NAME="Anabasis F-Droid Repo" REPO_NAME="Anabasis F-Droid Repo"
REPO_DESC="Automatically generated F-Droid repository" REPO_DESC="Automatically generated F-Droid repository"
GPG_KEY_ALIAS="${{ secrets.FDROID_GPG_KEY_ALIAS }}" # если используете подпись репо GPG_KEY_ALIAS="${{ secrets.FDROID_GPG_KEY_ALIAS }}"
GPG_KEYSTORE_PATH="fdroid-repo/keystore.jks" # путь к keystore или base64 GPG_KEYSTORE_PATH="fdroid-repo/keystore.jks"
GPG_KEY_PASSWORD="${{ secrets.FDROID_KEY_PASSWORD }}" 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" \ printf "repo_url: %s\nrepo_name: %s\nrepo_description: %s\nrepo_keyalias: %s\nkeystore: %s\nkeypass: %s\n" \
"$REPO_URL" \ "$REPO_URL" \
"$REPO_NAME" \ "$REPO_NAME" \
@@ -151,16 +149,16 @@ jobs:
"$GPG_KEY_PASSWORD" \ "$GPG_KEY_PASSWORD" \
> fdroid-repo/config.yml > fdroid-repo/config.yml
# ------------------- Generate F-Droid Index -------------------
# ------------------- Generate F-Droid Index -------------------
- name: Generate F-Droid Index - name: Generate F-Droid Index
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
run: | 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 ------------------- # ------------------- Deploy F-Droid Repo via SCP -------------------
- name: Deploy F-Droid Repo via SCP - name: Deploy F-Droid Repo via SCP
if: steps.stop.outputs.continue == 'true' if: env.CONTINUE == 'true'
env: env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SCP_SERVER: ${{ secrets.SCP_SERVER }} 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