chore: Build profile mode when no version tag (#223)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-02-09 10:21:53 +01:00 committed by GitHub
parent 4371368fda
commit c561a0be96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,20 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
- name: Decode Keystore - name: Determine Build Type
run: |
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then
echo "BUILD_MODE=release" >> $GITHUB_ENV
echo "ARTIFACT_SUFFIX=release-signed" >> $GITHUB_ENV
echo "AAB_PATH=productionRelease" >> $GITHUB_ENV
else
echo "BUILD_MODE=profile" >> $GITHUB_ENV
echo "ARTIFACT_SUFFIX=production" >> $GITHUB_ENV
echo "AAB_PATH=productionProfile" >> $GITHUB_ENV
fi
- name: Decode Keystore for release
if: startsWith(github.ref, 'refs/tags/v')
env: env:
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }} ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
@ -84,14 +97,14 @@ jobs:
- name: Build Android APK and AAB - name: Build Android APK and AAB
run: | run: |
flutter build apk --release --build-number=${{github.run_number}} --flavor production flutter build apk --${{ env.BUILD_MODE }} --build-number=${{github.run_number}} --flavor production
flutter build appbundle --release --build-number=${{github.run_number}} --flavor production flutter build appbundle --${{ env.BUILD_MODE }} --build-number=${{github.run_number}} --flavor production
- name: Rename APK and AAB - name: Rename APK and AAB
run: | run: |
mkdir -p build/app/outputs/android_artifacts mkdir -p build/app/outputs/android_artifacts
mv build/app/outputs/flutter-apk/app-production-release.apk "build/app/outputs/android_artifacts/release-signed.apk" mv build/app/outputs/flutter-apk/app-production-${{ env.BUILD_MODE }}.apk "build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}.apk"
mv build/app/outputs/bundle/productionRelease/app-production-release.aab "build/app/outputs/android_artifacts/release-signed.aab" mv build/app/outputs/bundle/${{ env.AAB_PATH }}/app-production-${{ env.BUILD_MODE }}.aab "build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}.aab"
- name: Archive Android artifacts - name: Archive Android artifacts
uses: actions/upload-artifact@v4.0.0 uses: actions/upload-artifact@v4.0.0