Skip to content

Commit

Permalink
chore: Adding iOS workflow file. #342
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Oct 25, 2023
1 parent 11f4552 commit ee23878
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 6 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/deploy_ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Deploy iOS (Apple App Store)
on:
# Only trigger, when the "build" workflow succeeded (only works in the Master Branch)
workflow_run:
workflows: ["Build & Test"]
types:
- completed

# Only trigger, when pushing into the `main` branch
push:
branches: [main]

# DELETE THIS
#pull_request:
# branches: [ "main" ]

permissions:
contents: write

jobs:
build-and-deploy_android:
runs-on: macos-latest

steps:

- name: ⬇️ Checkout repository
uses: actions/checkout@v3

- name: 🔐 Install Apple certificate and provisioning profile
env:
P12_DISTRIBUTION_CERTIFICATE_BASE64: "${{ secrets.IOS_P12_DISTRIBUTION_CERTIFICATE_BASE64 }}"
P12_DISTRIBUTION_CERTIFICATE_PASSWORD: "${{ secrets.IOS_P12_DISTRIBUTION_CERTIFICATE_PASSWORD }}"
DISTRIBUTION_PROVISIONING_PROFILE_BASE64: "${{ secrets.IOS_DISTRIBUTION_PROVISIONING_PROFILE_BASE64 }}"
KEYCHAIN_PASSWORD: "${{ secrets.IOS_RUNNER_LOCAL_KEYCHAIN_PASSWORD }}"
EXPORT_OPTIONS_BASE64: "${{ secrets.IOS_EXPORT_OPTIONS_BASE64 }}"
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PROVISIONING_PROFILE_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
EXPORT_OPTIONS_PATH="${{ github.workspace }}/app/ios/Runner/ExportOptions.plist"
# import certificate, provisioning profile and export options from secrets
echo -n "$P12_DISTRIBUTION_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$DISTRIBUTION_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PROVISIONING_PROFILE_PATH
echo -n "$EXPORT_OPTIONS_BASE64" | base64 --decode -o $EXPORT_OPTIONS_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 $CERTIFICATE_PATH -P "$P12_DISTRIBUTION_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PROVISIONING_PROFILE_PATH ~/Library/MobileDevice/Provisioning\ Profiles
# Needed to run Flutter-based commands
- name: 🐦 Install Flutter
uses: subosito/flutter-action@v2
with:
# If the flutter version that is used in development increases, it's recommended this one increases as well
flutter-version: "3.13.5"
channel: "stable"
id: flutter

# Setting up Melos, which will
#- name: ⚙️ Setup Melos
# uses: bluefireteam/melos-action@v2

- name: 📚 Install dependencies
run: flutter pub get

- name: 🍏📦 Create iOS appbundle release
run: |
flutter build ipa \
--release \
--export-options-plist=ios/Runner/ExportOptions.plist
--obfuscate \
--split-debug-info=${{ github.workspace }}/build/app/outputs/symbols
- name: 🍏🚀 Deploy to App Store (Testflight)
uses: apple-actions/upload-testflight-build@v1
with:
app-path: ${{ github.workspace }}/app/build/ios/ipa/flutter_ci_cd_demo.ipa
issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
api-private-key: ${{ secrets.APP_STORE_CONNECT_API_PRIVATE_KEY }}
2 changes: 0 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Foundation
import device_info_plus
import emoji_picker_flutter
import file_selector_macos
import gal
import pasteboard
import path_provider_foundation
import shared_preferences_foundation
Expand All @@ -18,7 +17,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
Expand Down
3 changes: 0 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <gal/gal_plugin_c_api.h>
#include <pasteboard/pasteboard_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

Expand All @@ -17,8 +16,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
GalPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GalPluginCApi"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
1 change: 0 additions & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
list(APPEND FLUTTER_PLUGIN_LIST
emoji_picker_flutter
file_selector_windows
gal
pasteboard
url_launcher_windows
)
Expand Down

0 comments on commit ee23878

Please sign in to comment.