mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-13 03:17:48 -04:00
Refactor build steps to check channel input (#3337)
This commit is contained in:
38
.github/workflows/release.yml
vendored
38
.github/workflows/release.yml
vendored
@@ -43,7 +43,6 @@ permissions:
|
||||
|
||||
jobs:
|
||||
prepare-build-info:
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
APP_VERSION_NAME: ${{ steps.get_version_name.outputs.APP_VERSION_NAME }}
|
||||
@@ -56,11 +55,13 @@ jobs:
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
- name: Set up JDK 21
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'jetbrains'
|
||||
- name: Setup Gradle
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
@@ -92,14 +93,6 @@ jobs:
|
||||
needs: prepare-build-info
|
||||
environment: Release
|
||||
steps:
|
||||
- name: Check if build is required
|
||||
id: check_build
|
||||
run: |
|
||||
if [[ "${{ inputs.channel }}" == "internal" ]]; then
|
||||
echo "should_build=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
@@ -107,13 +100,13 @@ jobs:
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
- name: Set up JDK 21
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'jetbrains'
|
||||
- name: Setup Gradle
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
@@ -167,7 +160,7 @@ jobs:
|
||||
run: bundle exec fastlane ${{ steps.fastlane_lane.outputs.lane }}
|
||||
|
||||
- name: Upload Google AAB artifact
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: google-aab
|
||||
@@ -175,7 +168,7 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload Google APK artifact
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: google-apk
|
||||
@@ -183,7 +176,7 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
- name: Attest Google artifacts provenance
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
if: ${{ inputs.channel == 'internal' }}
|
||||
uses: actions/attest-build-provenance@v3
|
||||
with:
|
||||
subject-path: |
|
||||
@@ -191,23 +184,33 @@ jobs:
|
||||
app/build/outputs/apk/google/release/app-google-release.apk
|
||||
|
||||
release-fdroid:
|
||||
if: ${{ inputs.channel == 'internal'}}
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare-build-info
|
||||
environment: Release
|
||||
steps:
|
||||
- name: Check if build is required
|
||||
id: check_build
|
||||
run: |
|
||||
if [[ "${{ inputs.channel }}" == "internal" ]]; then
|
||||
echo "should_build=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Checkout code
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ inputs.tag_name }}
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
- name: Set up JDK 21
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'jetbrains'
|
||||
- name: Setup Gradle
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
@@ -216,6 +219,7 @@ jobs:
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
|
||||
- name: Load secrets
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
|
||||
@@ -225,18 +229,21 @@ jobs:
|
||||
echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
|
||||
|
||||
- name: Setup Fastlane
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.2'
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build F-Droid with Fastlane
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
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
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fdroid-apk
|
||||
@@ -244,6 +251,7 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
- name: Attest F-Droid APK provenance
|
||||
if: steps.check_build.outputs.should_build == 'true'
|
||||
uses: actions/attest-build-provenance@v3
|
||||
with:
|
||||
subject-path: app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
|
||||
|
||||
Reference in New Issue
Block a user