-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efc2e38
commit 9aa2f02
Showing
1 changed file
with
101 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Publish to App Store Connect | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-13 | ||
|
||
env: | ||
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} | ||
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} | ||
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }} | ||
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }} | ||
DIST_CERTIFICATE: ${{ secrets.DIST_CERTIFICATE_BASE64 }} | ||
DIST_CERTIFICATE_PASSWORD: ${{ secrets.DIST_CERTIFICATE_PASSWORD }} | ||
DIST_PROFILE: ${{ secrets.DIST_PROFILE_BASE64 }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Flutter SDK | ||
uses: subosito/[email protected] | ||
with: | ||
channel: 'stable' | ||
cache: true | ||
|
||
- name: Retrieve the secret and decode it to a file | ||
env: | ||
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }} | ||
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }} | ||
FIREBASE_APP_ID_FILE_JSON_BASE64: ${{ secrets.FIREBASE_APP_ID_FILE_JSON_BASE64 }} | ||
run: | | ||
cd app | ||
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart | ||
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist | ||
echo $FIREBASE_APP_ID_FILE_JSON_BASE64 | base64 --decode > ios/firebase_app_id_file.json | ||
- name: Install dependencies | ||
run: | | ||
cd app | ||
flutter clean | ||
flutter pub get | ||
cd ../data | ||
flutter clean | ||
flutter pub get | ||
cd ../style | ||
flutter clean | ||
flutter pub get | ||
cd .. | ||
- name: Install Codemagic CLI tools | ||
run: pip install codemagic-cli-tools | ||
|
||
- name: Set up keychain | ||
run: keychain initialize | ||
|
||
- name: Set up Provisioning Profiles | ||
run: | | ||
PROFILES_HOME="$HOME/Library/MobileDevice/Provisioning Profiles" | ||
mkdir -p "$PROFILES_HOME" | ||
PROFILE_PATH="$(mktemp "$PROFILES_HOME"/$(uuidgen).mobileprovision)" | ||
echo ${DIST_PROFILE} | base64 --decode > "$PROFILE_PATH" | ||
echo "Saved Provisioning profile $PROFILE_PATH" | ||
- name: Set up Signing certificate | ||
run: | | ||
echo $DIST_CERTIFICATE | base64 --decode > /tmp/certificate.p12 | ||
keychain add-certificates --certificate /tmp/certificate.p12 --certificate-password $DIST_CERTIFICATE_PASSWORD | ||
- name: Set up code signing settings on Xcode project | ||
run: xcode-project use-profiles | ||
|
||
- name: Build ipa for distribution | ||
run: | | ||
cd app | ||
file='VERSION' | ||
fileData=$(cat $file) | ||
IFS='.' | ||
read -a versionValue <<< "$fileData" | ||
buildNumber=$(( ${versionValue[0]} * 1000000 + ${versionValue[1]} * 10000 + CI_PIPELINE_IID )) | ||
IFS='' | ||
buildName="${versionValue[0]}.${versionValue[1]}.$CI_PIPELINE_IID" | ||
echo "Generating android build $buildName $buildNumber" | ||
flutter build ipa --release --build-number=$buildNumber --build-name=$buildName --export-options-plist=$HOME/export_options.plist | ||
- name: Publish the app to App Store Connect | ||
run: | | ||
APP_FILE=$(find $(pwd) -name "*.ipa") | ||
app-store-connect publish \ | ||
--path "$APP_FILE" | ||
|
||
|