v0.17.2 #83
Workflow file for this run
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: Build for iOS | |
# Using instructions from | |
# https://docs.flutter.dev/deployment/ios#create-a-build-archive-with-codemagic-cli-tools | |
on: | |
# Enable manual run | |
workflow_dispatch: | |
push: | |
tags: | |
- '**' | |
env: | |
project-id: com.adilhanney.saber | |
jobs: | |
get-version: | |
name: Get version | |
runs-on: ubuntu-latest | |
outputs: | |
buildName: ${{ steps.get_version.outputs.buildName }} | |
buildNumber: ${{ steps.get_version.outputs.buildNumber }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get version | |
id: get_version | |
run: | | |
# get buildName from lib/data/version.dart | |
buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart) | |
echo "buildName=$buildName" >> $GITHUB_OUTPUT | |
# get buildNumber from lib/data/version.dart | |
buildNumber=$(grep -oP '(?<=buildNumber = ).*(?=;)' lib/data/version.dart) | |
echo "buildNumber=$buildNumber" >> $GITHUB_OUTPUT | |
build-ios: | |
name: Build for iOS | |
runs-on: macos-latest | |
needs: get-version | |
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_CERTIFICATE_KEY: ${{secrets.APP_STORE_CERTIFICATE_KEY}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Remove unneeded files | |
run: | | |
rm -rf android | |
rm -rf appimage | |
rm -rf assets_raw | |
rm -rf flatpak | |
rm -rf installers | |
rm -rf integration_test | |
rm -rf linux | |
rm -rf macos | |
rm -rf metadata | |
rm -rf snap | |
rm -rf submodules | |
rm -rf test | |
rm -rf windows | |
- name: Setup cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
build | |
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }} | |
restore-keys: | | |
${{ runner.OS }}-saber- | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:' | |
architecture: x64 | |
- name: Install Codemagic CLI Tools | |
run: pip3 install codemagic-cli-tools | |
- name: Setup keychain | |
run: | | |
keychain initialize | |
app-store-connect fetch-signing-files $(xcode-project detect-bundle-id) \ | |
--platform IOS \ | |
--type IOS_APP_STORE \ | |
--certificate-key=@env:APP_STORE_CERTIFICATE_KEY \ | |
--create | |
keychain add-certificates | |
xcode-project use-profiles | |
- run: flutter pub get | |
- run: find . -name "Podfile" -execdir pod install \; | |
- name: Build for iOS | |
id: build | |
run: | | |
flutter build ipa \ | |
--dart-define=FLAVOR="App Store" \ | |
--dart-define=APP_STORE="App Store" \ | |
--dart-define=UPDATE_CHECK="false" \ | |
--dart-define=DIRTY="false" \ | |
--export-options-plist=$HOME/export_options.plist | |
export ipaPath="Saber_v${{ needs.get-version.outputs.buildName }}.ipa" | |
mv $(find $(pwd) -name "*.ipa") $ipaPath | |
echo "ipaPath=$ipaPath" >> $GITHUB_OUTPUT | |
- name: Restore keychain | |
run: | | |
keychain use-login | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Saber-iOS-Archive | |
path: ${{ steps.build.outputs.ipaPath }} | |
- name: Publish to App Store | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: app-store-connect publish --path ${{ steps.build.outputs.ipaPath }} |