ci(build): add dynamic version extraction from git tags

This commit is contained in:
zarazaex69
2026-04-08 11:07:51 +03:00
parent dd4a55b831
commit fa302edddd
2 changed files with 26 additions and 2 deletions
+19
View File
@@ -88,6 +88,25 @@ jobs:
distribution: 'temurin'
java-version: '21'
- name: Extract version from tag
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME="${{ github.ref_name }}"
VERSION_NAME="${TAG_NAME#v}"
elif [[ "${{ github.event.inputs.release_tag }}" != "" ]]; then
TAG_NAME="${{ github.event.inputs.release_tag }}"
VERSION_NAME="${TAG_NAME#v}"
else
VERSION_NAME="dev-$(git rev-parse --short HEAD)"
fi
VERSION_CODE=$(date +%s)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
echo "Version: $VERSION_NAME ($VERSION_CODE)"
- name: Decode Keystore
uses: timheuer/base64-to-file@v1.2.4
id: android_keystore
+7 -2
View File
@@ -12,8 +12,13 @@ android {
applicationId = "xyz.zarazaex.olc"
minSdk = 24
targetSdk = 36
versionCode = 717
versionName = "2.0.17"
val envVersionName = System.getenv("VERSION_NAME")
val envVersionCode = System.getenv("VERSION_CODE")
versionCode = envVersionCode?.toIntOrNull() ?: 717
versionName = envVersionName ?: "2.0.17"
multiDexEnabled = true
val abiFilterList = (properties["ABI_FILTERS"] as? String)?.split(';')