Skip to content

Commit

Permalink
feat: android deployment (#153)
Browse files Browse the repository at this point in the history
Co-authored-by: u221711 <[email protected]>
  • Loading branch information
Grodien and Grodien authored Aug 6, 2024
1 parent 141463f commit 7949bdf
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 118 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/flutter_android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ on:
push:
paths:
- 'das_client/**'
branches: [ "main" ]
pull_request:
paths:
- 'das_client/**'
Expand Down Expand Up @@ -56,13 +55,4 @@ jobs:
- run: flutter test
- run: flutter build appbundle --flavor dev -t lib/main_dev.dart
- run: flutter build appbundle --flavor inte -t lib/main_inte.dart
- run: flutter build appbundle --flavor prod -t lib/main_prod.dart
- name: Archive Apps
uses: actions/upload-artifact@v4
with:
name: Build
path: |
das_client/build/app/outputs/bundle/devRelease/**
das_client/build/app/outputs/bundle/inteRelease/**
das_client/build/app/outputs/bundle/prodRelease/**
retention-days: 1
- run: flutter build appbundle --flavor prod -t lib/main_prod.dart
50 changes: 4 additions & 46 deletions .github/workflows/flutter_ios_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,14 @@ jobs:
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
- name: Install the Apple signing certificate
env:
SBB_APPSTORE_BASE64: ${{ secrets.SBB_APPSTORE_BASE64 }}
SBB_APPSTORE_P12_PASSWORD: ${{ secrets.SBB_APPSTORE_P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
- name: Prepare Flutter Build
run: |
# create variables
SBB_CERTIFICATE_PATH=$RUNNER_TEMP/sbb_appstore.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$SBB_APPSTORE_BASE64" | base64 --decode -o $SBB_CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $SBB_CERTIFICATE_PATH -P "$SBB_APPSTORE_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: 'Download Provisioning Profiles DEV'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das.dev'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- name: 'Download Provisioning Profiles INTE'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das.inte'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- name: 'Download Provisioning Profiles PROD'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
- run: flutter test
- name: Build iOS App DEV
run: flutter build ios --flavor dev -t lib/main_dev.dart --release
run: flutter build ipa --flavor dev -t lib/main_dev.dart --release --no-codesign
- name: Build iOS App INTE
run: flutter build ios --flavor inte -t lib/main_inte.dart --release
run: flutter build ipa --flavor inte -t lib/main_inte.dart --release --no-codesign
- name: Build iOS App PROD
run: flutter build ios --flavor prod -t lib/main_prod.dart --release
run: flutter build ipa --flavor prod -t lib/main_prod.dart --release --no-codesign
75 changes: 70 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ jobs:
- uses: google-github-actions/release-please-action@v4
id: release

das-client-release:
das-client-ios-release:
needs: release-please
if: needs.release-please.outputs.das_client--release_created
runs-on: macos-latest
runs-on: macos-latest
concurrency:
group: das-client-ios-release
defaults:
run:
working-directory: das_client
Expand Down Expand Up @@ -99,23 +101,86 @@ jobs:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor dev -t lib/main_dev.dart --release
flutter build ipa --flavor dev -t lib/main_dev.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS Dev.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
- name: Build and Deploy iOS App INTE
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor inte -t lib/main_inte.dart --release
flutter build ipa --flavor inte -t lib/main_inte.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS Inte.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
- name: Build and Deploy iOS App PROD
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor prod -t lib/main_prod.dart --release
flutter build ipa --flavor prod -t lib/main_prod.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
das-client-android-release:
needs: release-please
if: needs.release-please.outputs.das_client--release_created
runs-on: macos-latest
concurrency:
group: das-client-android-release
defaults:
run:
working-directory: das_client
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
- name: Prepare Flutter Android Build
env:
ANDROID_KEYSTORE_STRING: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE: ${{ github.workspace }}/das_client/android/das.keystore
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
echo $ANDROID_KEYSTORE_STRING | base64 -d > $ANDROID_KEYSTORE
echo "ANDROID_KEYSTORE=$ANDROID_KEYSTORE" >> "$GITHUB_ENV"
echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV"
echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV"
echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV"
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
- run: flutter test
- run: flutter build appbundle --flavor dev -t lib/main_dev.dart
- run: flutter build appbundle --flavor inte -t lib/main_inte.dart
- run: flutter build appbundle --flavor prod -t lib/main_prod.dart
- name: Upload DEV App
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client.dev
releaseFiles: das_client/build/app/outputs/bundle/devRelease/app-dev-release.aab
track: internal
status: draft
- name: Upload INTE App
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client.inte
releaseFiles: das_client/build/app/outputs/bundle/inteRelease/app-inte-release.aab
track: internal
status: draft
- name: Upload PROD App
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client
releaseFiles: das_client/build/app/outputs/bundle/prodRelease/app-prod-release.aab
track: internal
status: draft

backend-release:
needs: release-please
if: needs.release-please.outputs.playground-backend--release_created
Expand Down
Loading

0 comments on commit 7949bdf

Please sign in to comment.