mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(ci): migrate to fastlane for release management (#3038)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
(cherry picked from commit 5cfa44cb64)
This commit is contained in:
parent
bf11b7b342
commit
d2d5487d92
32 changed files with 588 additions and 212 deletions
211
.github/workflows/release.yml
vendored
211
.github/workflows/release.yml
vendored
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
# This will overflow Integer.MAX_VALUE in the year 6052, hopefully we'll have moved on by then.
|
||||
run: echo "versionCode=$(( $(date +%s) / 60 ))" >> $GITHUB_OUTPUT
|
||||
|
||||
build-fdroid:
|
||||
release-google:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare-build-info
|
||||
steps:
|
||||
|
|
@ -79,54 +79,7 @@ jobs:
|
|||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
|
||||
- name: Load Fdroid secrets
|
||||
run: |
|
||||
echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
|
||||
echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
|
||||
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
|
||||
|
||||
- name: Build F-Droid Release APK
|
||||
run: |
|
||||
./gradlew :app:assembleFdroidRelease --parallel --continue --scan
|
||||
env:
|
||||
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
|
||||
VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
|
||||
|
||||
- name: Upload F-Droid APK artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fdroid-apk
|
||||
path: app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
|
||||
retention-days: 1
|
||||
|
||||
build-google:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare-build-info
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'jetbrains'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
build-scan-publish: true
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
|
||||
- name: Load Google secrets
|
||||
- name: Load secrets
|
||||
env:
|
||||
GSERVICES: ${{ secrets.GSERVICES }}
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
|
|
@ -135,6 +88,7 @@ jobs:
|
|||
DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
|
||||
DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
|
||||
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
|
||||
GOOGLE_PLAY_JSON_KEY: ${{ secrets.GOOGLE_PLAY_JSON_KEY }}
|
||||
run: |
|
||||
rm -f ./app/google-services.json # Ensure clean state
|
||||
echo $GSERVICES > ./app/google-services.json
|
||||
|
|
@ -143,13 +97,33 @@ jobs:
|
|||
echo "datadogApplicationId=$DATADOG_APPLICATION_ID" >> ./secrets.properties
|
||||
echo "datadogClientToken=$DATADOG_CLIENT_TOKEN" >> ./secrets.properties
|
||||
echo "MAPS_API_KEY=$GOOGLE_MAPS_API_KEY" >> ./secrets.properties
|
||||
echo "$GOOGLE_PLAY_JSON_KEY" > ./fastlane/play-store-credentials.json
|
||||
|
||||
- name: Build Google Release Artifacts (AAB and APK)
|
||||
- name: Setup Fastlane
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.2'
|
||||
bundler-cache: true
|
||||
|
||||
- name: Determine Fastlane Lane
|
||||
id: fastlane_lane
|
||||
run: |
|
||||
./gradlew :app:bundleGoogleRelease :app:assembleGoogleRelease --parallel --continue --scan
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
if [[ "$TAG_NAME" == *"-internal"* ]]; then
|
||||
echo "lane=internal" >> $GITHUB_OUTPUT
|
||||
elif [[ "$TAG_NAME" == *"-closed"* ]]; then
|
||||
echo "lane=closed" >> $GITHUB_OUTPUT
|
||||
elif [[ "$TAG_NAME" == *"-open"* ]]; then
|
||||
echo "lane=open" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "lane=production" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Build and Deploy Google Play Tracks with Fastlane
|
||||
env:
|
||||
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
|
||||
VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
|
||||
run: bundle exec fastlane ${{ steps.fastlane_lane.outputs.lane }}
|
||||
|
||||
- name: Upload Google AAB artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
@ -165,21 +139,9 @@ jobs:
|
|||
path: app/build/outputs/apk/google/release/app-google-release.apk
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload Mapping File
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mapping
|
||||
path: app/build/outputs/mapping/googleRelease/mapping.txt
|
||||
retention-days: 1
|
||||
|
||||
publish-release:
|
||||
release-fdroid:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prepare-build-info, build-fdroid, build-google]
|
||||
outputs:
|
||||
RELEASE_UPLOAD_URL: ${{ steps.create_gh_release.outputs.upload_url }}
|
||||
CHANGELOG: ${{ steps.generate_changelog.outputs.changelog }}
|
||||
APP_VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
|
||||
APP_VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
|
||||
needs: prepare-build-info
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
|
@ -187,34 +149,69 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Download F-Droid APK
|
||||
uses: actions/download-artifact@v5
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'jetbrains'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
build-scan-publish: true
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
|
||||
- name: Load secrets
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
|
||||
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
|
||||
run: |
|
||||
echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
|
||||
echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
|
||||
|
||||
- name: Setup Fastlane
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.2'
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build F-Droid with Fastlane
|
||||
env:
|
||||
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
|
||||
VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
|
||||
run: bundle exec fastlane fdroid_build
|
||||
|
||||
- name: Upload F-Droid APK artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fdroid-apk
|
||||
path: ./build-artifacts/fdroid
|
||||
path: app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
|
||||
retention-days: 1
|
||||
|
||||
finalize-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-google, release-fdroid]
|
||||
steps:
|
||||
- name: Download Google AAB
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: google-aab
|
||||
path: ./build-artifacts/google/bundle
|
||||
path: ./google/bundle
|
||||
|
||||
- name: Download Google APK
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: google-apk
|
||||
path: ./build-artifacts/google/apk
|
||||
path: ./google/apk
|
||||
|
||||
- name: Download Mapping File
|
||||
uses: actions/download-artifact@v5
|
||||
- name: Download F-Droid APK
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: mapping
|
||||
path: ./build-artifacts/google/mapping
|
||||
|
||||
- name: Create version_info.txt
|
||||
run: |
|
||||
echo "versionNameBase=${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}" > ./version_info.txt
|
||||
echo "versionCode=${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}" >> ./version_info.txt
|
||||
name: fdroid-apk
|
||||
path: ./fdroid
|
||||
|
||||
- name: Create GitHub Release
|
||||
id: create_gh_release
|
||||
|
|
@ -224,56 +221,10 @@ jobs:
|
|||
name: Release ${{ github.ref_name }}
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
./build-artifacts/google/bundle/app-google-release.aab
|
||||
./build-artifacts/google/apk/app-google-release.apk
|
||||
./build-artifacts/fdroid/app-fdroid-release.apk
|
||||
./version_info.txt
|
||||
./google/bundle/app-google-release.aab
|
||||
./google/apk/app-google-release.apk
|
||||
./fdroid/app-fdroid-release.apk
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref_name, '-internal') || contains(github.ref_name, '-closed') || contains(github.ref_name, '-open') }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create Play Store whatsnew File
|
||||
run: |
|
||||
mkdir -p whatsnew
|
||||
echo "For detailed release notes, please visit: ${{ steps.create_gh_release.outputs.url }}" > whatsnew/whatsnew-en-US
|
||||
shell: bash
|
||||
|
||||
# Attest the build artifacts for supply chain security.
|
||||
# See: https://github.com/meshtastic/Meshtastic-Android/attestations
|
||||
- name: Attest Build Provenance
|
||||
uses: actions/attest-build-provenance@v3
|
||||
with:
|
||||
subject-path: |
|
||||
./build-artifacts/google/bundle/app-google-release.aab
|
||||
./build-artifacts/google/apk/app-google-release.apk
|
||||
./build-artifacts/fdroid/app-fdroid-release.apk
|
||||
|
||||
- name: Determine Play Store Track
|
||||
id: play_track
|
||||
run: |
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
if [[ "$TAG_NAME" == *"-internal"* ]]; then
|
||||
echo "track=internal" >> $GITHUB_OUTPUT
|
||||
elif [[ "$TAG_NAME" == *"-closed"* ]]; then
|
||||
echo "track=NewAlpha" >> $GITHUB_OUTPUT
|
||||
elif [[ "$TAG_NAME" == *"-open"* ]]; then
|
||||
echo "track=beta" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "track=production" >> $GITHUB_OUTPUT
|
||||
echo "user_fraction=0.1" >> $GITHUB_OUTPUT
|
||||
echo "status=inProgress" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload to Google Play
|
||||
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
uses: r0adkll/upload-google-play@v1.1.3
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_JSON_KEY }}
|
||||
packageName: com.geeksville.mesh
|
||||
releaseFiles: ./build-artifacts/google/bundle/app-google-release.aab
|
||||
track: ${{ steps.play_track.outputs.track }}
|
||||
status: ${{ steps.play_track.outputs.status || (steps.play_track.outputs.track == 'internal' && 'completed' || 'draft') }}
|
||||
userFraction: ${{ steps.play_track.outputs.userFraction }}
|
||||
whatsNewDirectory: ./whatsnew/
|
||||
mappingFile: ./build-artifacts/google/mapping/mapping.txt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue