mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-06 21:56:55 -04:00
chore(ci): Decouple versioncode (#2393)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@@ -50,6 +50,7 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v4
|
||||
@@ -82,8 +83,20 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
- name: Calculate Version Code with Git Commit Count and Offset
|
||||
id: calculate_version_code
|
||||
run: |
|
||||
GIT_COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
OFFSET=30630 # to ensure versionCode is above 30630
|
||||
VERSION_CODE=$((GIT_COMMIT_COUNT + OFFSET))
|
||||
echo "Calculated versionCode: $VERSION_CODE (from $GIT_COMMIT_COUNT commits + $OFFSET offset)"
|
||||
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
|
||||
|
||||
- name: Build F-Droid release
|
||||
run: ./gradlew assembleFdroidRelease
|
||||
env:
|
||||
VERSION_CODE: ${{ env.VERSION_CODE }}
|
||||
|
||||
- name: Upload F-Droid APK artifact (for release job)
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -108,6 +121,7 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v4
|
||||
@@ -143,8 +157,19 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Calculate Version Code with Git Commit Count and Offset
|
||||
id: calculate_version_code
|
||||
run: |
|
||||
GIT_COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
OFFSET=30630 # to ensure versionCode is above 30630
|
||||
VERSION_CODE=$((GIT_COMMIT_COUNT + OFFSET))
|
||||
echo "Calculated versionCode: $VERSION_CODE (from $GIT_COMMIT_COUNT commits + $OFFSET offset)"
|
||||
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
|
||||
|
||||
- name: Build Play Store release
|
||||
run: ./gradlew bundleGoogleRelease assembleGoogleRelease
|
||||
env:
|
||||
VERSION_CODE: ${{ env.VERSION_CODE }}
|
||||
|
||||
- name: Upload Play Store AAB artifact (for release job)
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
13
.github/workflows/reusable-android-build.yml
vendored
13
.github/workflows/reusable-android-build.yml
vendored
@@ -20,6 +20,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
@@ -55,8 +56,20 @@ jobs:
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
add-job-summary: always
|
||||
|
||||
- name: Calculate Version Code with Git Commit Count and Offset
|
||||
id: calculate_version_code
|
||||
run: |
|
||||
GIT_COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
OFFSET=30630 # to ensure versionCode is above 30630 (our last manual versionCode)
|
||||
VERSION_CODE=$((GIT_COMMIT_COUNT + OFFSET))
|
||||
echo "Calculated versionCode: $VERSION_CODE (from $GIT_COMMIT_COUNT commits + $OFFSET offset)"
|
||||
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
|
||||
|
||||
- name: Run Detekt, Build, Lint, and Local Tests
|
||||
run: ./gradlew detekt lintFdroidDebug lintGoogleDebug assembleDebug testFdroidDebug testGoogleDebug --configuration-cache --scan
|
||||
env:
|
||||
VERSION_CODE: ${{ env.VERSION_CODE }}
|
||||
- name: Upload F-Droid debug artifact
|
||||
if: ${{ inputs.upload_artifacts }}
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -52,8 +52,8 @@ android {
|
||||
applicationId = Configs.APPLICATION_ID
|
||||
minSdk = Configs.MIN_SDK_VERSION
|
||||
targetSdk = Configs.TARGET_SDK
|
||||
versionCode =
|
||||
Configs.VERSION_CODE // format is Mmmss (where M is 1+the numeric major number)
|
||||
versionCode = System.getenv("VERSION_CODE")?.toIntOrNull()
|
||||
?: 1
|
||||
versionName = Configs.VERSION_NAME
|
||||
testInstrumentationRunner = "com.geeksville.mesh.TestRunner"
|
||||
buildConfigField("String", "MIN_FW_VERSION", "\"${Configs.MIN_FW_VERSION}\"")
|
||||
|
||||
@@ -20,7 +20,6 @@ object Configs {
|
||||
const val MIN_SDK_VERSION = 26
|
||||
const val TARGET_SDK = 36
|
||||
const val COMPILE_SDK = 36
|
||||
const val VERSION_CODE = 30630 // format is Mmmss (where M is 1+the numeric major number)
|
||||
const val VERSION_NAME = "2.6.30"
|
||||
const val MIN_FW_VERSION = "2.5.14" // Minimum device firmware version supported by this app
|
||||
const val ABS_MIN_FW_VERSION = "2.3.15" // Minimum device firmware version supported by this app
|
||||
|
||||
Reference in New Issue
Block a user