diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5b6e1d0..38dd43ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/V2rayNG/app/build.gradle.kts b/V2rayNG/app/build.gradle.kts index 1beb9127..3871e279 100644 --- a/V2rayNG/app/build.gradle.kts +++ b/V2rayNG/app/build.gradle.kts @@ -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(';')