From b790c1a7039d4fdef4f6ef1982b893ea84eb5d6c Mon Sep 17 00:00:00 2001 From: u221711 Date: Tue, 6 Aug 2024 08:57:25 +0200 Subject: [PATCH] cleanup and move to release-please --- .github/workflows/flutter_ios_build.yml | 45 +++----------- .github/workflows/release-please.yml | 78 +++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 42 deletions(-) diff --git a/.github/workflows/flutter_ios_build.yml b/.github/workflows/flutter_ios_build.yml index 51dd2d5a..0c158555 100644 --- a/.github/workflows/flutter_ios_build.yml +++ b/.github/workflows/flutter_ios_build.yml @@ -30,21 +30,18 @@ jobs: - uses: subosito/flutter-action@v2 with: flutter-version: '3.22.2' - - name: Install the Apple signing certificate and appstore connect key + - 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 }} - APPSTORE_CONNECT_PRIVATE_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY_BASE64 }} run: | # create variables SBB_CERTIFICATE_PATH=$RUNNER_TEMP/sbb_appstore.p12 KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db - APPSTORE_CONNECT_PRIVATE_KEY_PATH=~/AuthKey.p8 - # import certificate and private key from secrets + # import certificate from secrets echo -n "$SBB_APPSTORE_BASE64" | base64 --decode -o $SBB_CERTIFICATE_PATH - echo -n "$APPSTORE_CONNECT_PRIVATE_KEY_BASE64" | base64 --decode -o $APPSTORE_CONNECT_PRIVATE_KEY_PATH # create temporary keychain security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH @@ -80,35 +77,9 @@ jobs: flutter pub get flutter pub run build_runner build --delete-conflicting-outputs - run: flutter test - - name: Build and Deploy iOS App DEV - env: - 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 --export-options-plist=ios/exportOptionsRelease.plist - 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 - 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 - 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 - - name: Archive Apps - uses: actions/upload-artifact@v4 - with: - name: Build - path: | - das_client/build/ios/archive/** - das_client/build/ios/ipa/** - das_client/build/ios/iphoneos/** - retention-days: 1 - - + - name: Build iOS App DEV + run: flutter build ios --flavor dev -t lib/main_dev.dart --release + - name: Build iOS App INTE + run: flutter build ios --flavor inte -t lib/main_inte.dart --release + - name: Build iOS App PROD + run: flutter build ios --flavor prod -t lib/main_prod.dart --release \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 3e0c60d9..cc090688 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -41,17 +41,85 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.19.2' - - run: flutter pub get - - run: flutter test - - run: flutter build appbundle + flutter-version: '3.22.2' - name: Upload Release Artifact env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh release upload ${{ needs.release-please.outputs.das_client--tag_name }} build/app/outputs/bundle/release/app-release.aab + - name: Install the Apple signing certificate and appstore connect key + env: + SBB_APPSTORE_BASE64: ${{ secrets.SBB_APPSTORE_BASE64 }} + SBB_APPSTORE_P12_PASSWORD: ${{ secrets.SBB_APPSTORE_P12_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APPSTORE_CONNECT_PRIVATE_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY_BASE64 }} + run: | + # create variables + SBB_CERTIFICATE_PATH=$RUNNER_TEMP/sbb_appstore.p12 + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + APPSTORE_CONNECT_PRIVATE_KEY_PATH=~/AuthKey.p8 + + # import certificate and private key from secrets + echo -n "$SBB_APPSTORE_BASE64" | base64 --decode -o $SBB_CERTIFICATE_PATH + echo -n "$APPSTORE_CONNECT_PRIVATE_KEY_BASE64" | base64 --decode -o $APPSTORE_CONNECT_PRIVATE_KEY_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 + - name: Build and Deploy iOS App DEV + env: + 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 + 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 + 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 + 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 + backend-release: needs: release-please if: needs.release-please.outputs.playground-backend--release_created