mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-18 19:56:34 -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
|
||||
|
||||
Reference in New Issue
Block a user