Fix lint error #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Test Flutter STG | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
default: main | |
description: 'Git Tag, Branch or SHA to build' | |
required: true | |
secrets: | |
BUILD_USER_PAT: | |
required: true | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
secrets: | |
BUILD_USER_PAT: | |
required: true | |
jobs: | |
build-android: | |
name: Generate Play Store STG | |
permissions: | |
actions: write | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17.0.6 | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v2 | |
with: | |
channel: stable | |
version: 3.19.5 | |
- name: 'Checkout ${{ inputs.ref }}' | |
uses: actions/checkout@v2 | |
with: | |
path: source | |
ref: '${{ inputs.ref }}' | |
- name: Install Google API python client | |
run: | | |
pip install google-api-python-client | |
- name: Get new version code | |
run: | | |
echo $GOOGLE_PLAY_SERVICE_ACCOUNT > $RUNNER_TEMP/.service_account | |
python3 build-utils/get_version_code.py $RUNNER_TEMP/.service_account com.namiml.testflutter.stg internal --quiet >> $RUNNER_TEMP/.new_version_code | |
rm -f .service_account | |
env: | |
GOOGLE_PLAY_SERVICE_ACCOUNT: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}' | |
working-directory: source | |
- name: Create the Keystore | |
run: | | |
# import keystore from secrets | |
echo $KEYSTORE_BASE64 | base64 -d > $RUNNER_TEMP/my_production.keystore | |
env: | |
KEYSTORE_BASE64: '${{ secrets.KEY_STORE_BASE64 }}' | |
- name: Get dependencies | |
run: | | |
flutter pub get | |
working-directory: source/sdk/example/testnami | |
- name: Build Android App Bundle | |
run: | | |
export BUILD_NUMBER_STG=`cat $RUNNER_TEMP/.new_version_code` | |
flutter build appbundle -t lib/main_staging.dart --flavor stg --release --build-name 1.0.0 --build-number $BUILD_NUMBER_STG | |
working-directory: source/sdk/example/testnami | |
- name: Sign Android App Bundle | |
run: | | |
jarsigner -keystore $RUNNER_TEMP/my_production.keystore -storepass '${{ secrets.KEY_STORE_PASSWORD }}' -keypass '${{ secrets.KEY_PASSWORD }}' -sigalg SHA256withRSA -digestalg SHA-256 -signedjar build/app/outputs/bundle/stgRelease/app-stg-release-signed.aab build/app/outputs/bundle/stgRelease/app-stg-release.aab '${{ secrets.KEY_ALIAS }}' | |
working-directory: source/sdk/example/testnami | |
- name: Uploading to test track | |
uses: r0adkll/[email protected] | |
with: | |
packageName: 'com.namiml.testflutter.stg' | |
releaseFiles: source/sdk/example/testnami/build/app/outputs/bundle/stgRelease/app-stg-release-signed.aab | |
serviceAccountJsonPlainText: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}' | |
status: completed | |
track: internal | |
build-ios: | |
name: Generate Apple STG | |
permissions: | |
actions: write | |
contents: write | |
id-token: write | |
runs-on: macos-14 | |
steps: | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17.0.6 | |
- name: Set Xcode Version | |
run: | | |
sudo xcode-select -switch /Applications/Xcode_15.4.app | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v2 | |
with: | |
channel: stable | |
version: 3.19.5 | |
- name: 'Checkout ${{ inputs.ref }}' | |
uses: actions/checkout@v2 | |
with: | |
path: source | |
ref: '${{ inputs.ref }}' | |
- name: Checkout appstoreconnect-build-tools | |
uses: actions/checkout@v2 | |
with: | |
path: appstoreconnect-build-tools | |
ref: main | |
repository: namiml/appstoreconnect-build-tools | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Get expected build number | |
run: | | |
pip3 install requests | |
pip3 install pydantic==1.10.11 | |
pip3 install cryptography | |
pip3 install PyJWT | |
echo "1.0.0" > $RUNNER_TEMP/.current_version | |
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version` | |
python3 get_next_build.py com.namiml.stg.testflutter --prerelease --version=$CURRENT_VERSION > $RUNNER_TEMP/.next_build_number | |
working-directory: appstoreconnect-build-tools | |
env: | |
APPSTORE_API_KEY_ID: '${{ secrets.APPSTORE_API_KEY_ID }}' | |
APPSTORE_API_PRIVATE_KEY: '${{ secrets.APPSTORE_API_PRIVATE_KEY }}' | |
APPSTORE_ISSUER_ID: '${{ secrets.APPSTORE_ISSUER_ID }}' | |
- name: Install Apple Certificate | |
uses: apple-actions/import-codesign-certs@v1 | |
with: | |
p12-file-base64: '${{ secrets.IOS_P12_BASE64 }}' | |
p12-password: '${{ secrets.IOS_CERTIFICATE_PASSWORD }}' | |
- name: Install the provisioning profile | |
run: | | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
env: | |
PROVISIONING_CERTIFICATE_BASE64: '${{ secrets.IOS_MOBILE_PROVISION_BASE64_TEST_FLUTTER_STG }}' | |
- name: Get dependencies | |
run: | | |
flutter pub get | |
working-directory: source/sdk/example/testnami | |
- name: Store App Store Private Key | |
run: | | |
mkdir ~/.private_keys | |
echo '${{ secrets.APPSTORE_API_PRIVATE_KEY }}' > ~/.private_keys/AuthKey_'${{ secrets.APPSTORE_API_KEY_ID }}'.p8 | |
- name: Update ExportOptions.plist | |
run: | | |
sed -i '' -e "s/APPSTORE_TEAM_ID/${{ secrets.APPSTORE_TEAM_ID }}/" ExportOptions.plist | |
sed -i '' -e "s/APPSTORE_PROVISIONING_PROFILE_UUID/${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_FLUTTER_STG }}/g" ExportOptions.plist | |
working-directory: source/sdk/example/testnami/ios | |
- name: Adjust version & build number | |
working-directory: source/sdk/example/testnami | |
run: |- | |
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version` | |
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number` | |
sed -i '' -e "s/CURRENT_PROJECT_VERSION = 1/CURRENT_PROJECT_VERSION = $BUILD_NUMBER/" ios/Runner.xcodeproj/project.pbxproj | |
sed -i '' -e "s/MARKETING_VERSION = 1.0/MARKETING_VERSION = $CURRENT_VERSION/" ios/Runner.xcodeproj/project.pbxproj | |
- name: Build iOS | |
run: | | |
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version` | |
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number` | |
sed -i '' -e "s/1.0.0+1/$CURRENT_VERSION+$BUILD_NUMBER/" pubspec.yaml | |
flutter build ios --release --no-codesign --flavor stg -t lib/main_staging.dart --build-name $CURRENT_VERSION --build-number $BUILD_NUMBER | |
working-directory: source/sdk/example/testnami | |
- name: Build resolve Swift dependencies | |
run: | | |
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme stg -configuration Release-stg | |
working-directory: source/sdk/example/testnami | |
- name: Build xArchive | |
run: | | |
xcodebuild -workspace ios/Runner.xcworkspace -scheme stg -configuration Release-stg DEVELOPMENT_TEAM='${{ secrets.APPSTORE_TEAM_ID }}' -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app-stg.xcarchive PROVISIONING_PROFILE='${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_FLUTTER_STG }}' clean archive CODE_SIGN_IDENTITY='${{ secrets.CODE_SIGNING_IDENTITY }}' | |
working-directory: source/sdk/example/testnami | |
- name: Export IPA | |
run: | | |
xcodebuild -exportArchive -archivePath build-output/app-stg.xcarchive -exportPath build-output/ios-stg -exportOptionsPlist ios/ExportOptions.plist | |
working-directory: source/sdk/example/testnami | |
- name: Upload app to TestFlight | |
run: | | |
xcrun altool --upload-app --type ios --file build-output/ios-stg/example.ipa --apiKey $APPSTORE_API_KEY_ID --apiIssuer $APPSTORE_ISSUER_ID | |
working-directory: source/sdk/example/testnami | |
env: | |
APPSTORE_API_KEY_ID: '${{ secrets.APPSTORE_API_KEY_ID }}' | |
APPSTORE_ISSUER_ID: '${{ secrets.APPSTORE_ISSUER_ID }}' |