fix: deploy workflow #36
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: Deploy iOS | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
- fix/ios-deploy | |
jobs: | |
build: | |
runs-on: macos-14 | |
timeout-minutes: 60 | |
env: | |
TZ: Asia/Tokyo | |
FLUTTER_VERSION: | |
FLUTTER_CHANNEL: | |
FLUTTER_HOME: | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all history for all tags and branches | |
fetch-depth: 0 | |
- name: Set up ssh | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_ID_ED25519 }}" | base64 -d > ~/.ssh/id_ed25519 | |
chmod 700 ~/.ssh/id_ed25519 | |
eval $(ssh-agent -s) | |
echo "Host github.com \n\tIdentityFile ~/.ssh/id_ed25519\n\tUser git\n\tIdentityiesOnly yes" >> ~/.ssh/config | |
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest | |
- name: Show Xcode version | |
run: xcodebuild -version | |
- name: Fetch flutter config | |
id: fvm-config-action | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
# https://github.com/subosito/flutter-action | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} | |
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }} | |
cache: true | |
- name: Install Gems | |
working-directory: app/ios | |
run: | | |
gem install bundler | |
bundle install | |
- name: Install Brewfile dependencies | |
working-directory: app/ios | |
run: brew bundle | |
- name: Cache pubspec dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ env.FLUTTER_HOME }}/.pub-cache | |
**/.packages | |
**/.flutter-plugins | |
**/.flutter-plugin-dependencies | |
**/.dart_tool/package_config.json | |
key: build-pubspec-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: | | |
build-pubspec- | |
- name: Setup melos | |
run: | | |
ln -s $FLUTTER_ROOT .fvm/flutter_sdk | |
dart pub global activate melos | |
- name: Resolve dependencies | |
run: melos bootstrap | |
- name: Run build_runner | |
run: | | |
echo '${{ secrets.ENV }}' | base64 -d > app/.env | |
ln -s $FLUTTER_ROOT .fvm/flutter_sdk | |
melos generate | |
- name: Cache Pods | |
uses: actions/cache@v2 | |
with: | |
path: app/ios/Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Install dependencies | |
working-directory: app/ios | |
run: pod install | |
- name: Set Firebase Configuration | |
run: echo '${{ secrets.FIREBASE_IOS }}' | base64 -d > app/ios/Runner/GoogleService-Info.plist | |
- name: Set App Store Connect Configuration | |
working-directory: app | |
run: | | |
echo '${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }}' | base64 -d > AuthKey_NGL2W4BQP6.p8 | |
cp *.p8 ios/ | |
- name: Increment build number | |
working-directory: app/ios | |
env: | |
PRODUCE_USERNAME: ${{ secrets.PRODUCE_USERNAME }} | |
SPACESHIP_ONLY_ALLOW_INTERACTIVE_2FA: false | |
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} | |
FASTLANE_USER: [email protected] | |
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} | |
LANG: ja_JP.UTF-8 | |
run: fastlane setup_build_number | |
- name: Prebuild | |
working-directory: app | |
run: flutter build ios --release --no-codesign | |
- name: Build IPA | |
working-directory: app | |
env: | |
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} | |
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} | |
APP_STORE_CONNECT_API_KEY_BASE64: ${{secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} | |
run: | | |
xcodebuild \ | |
-workspace ios/Runner.xcworkspace \ | |
-scheme Runner \ | |
-sdk iphoneos \ | |
-configuration Release archive \ | |
-archivePath build/ios/Runner.xcarchive \ | |
CODE_SIGNING_REQUIRED=NO \ | |
CODE_SIGNING_ALLOWED=NO | xcbeautify | |
xcodebuild -exportArchive \ | |
-archivePath build/ios/Runner.xcarchive \ | |
-exportOptionsPlist ios/ExportOptions.plist \ | |
-exportPath . -allowProvisioningUpdates \ | |
-authenticationKeyIssuerID ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} \ | |
-authenticationKeyID ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} \ | |
-authenticationKeyPath `pwd`/AuthKey_NGL2W4BQP6.p8 | xcbeautify | |
mv eqmonitor.ipa ios/Runner.ipa | |
- name: Upload to App Store Connect | |
working-directory: app/ios | |
env: | |
PRODUCE_USERNAME: ${{ secrets.PRODUCE_USERNAME }} | |
SPACESHIP_ONLY_ALLOW_INTERACTIVE_2FA: false | |
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} | |
FASTLANE_USER: [email protected] | |
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} | |
LANG: ja_JP.UTF-8 | |
run: fastlane upload |