Skip to content

Commit

Permalink
ci-cd: Setup fastlane
Browse files Browse the repository at this point in the history
  • Loading branch information
roxk committed Sep 9, 2024
1 parent 97a2874 commit dd26ff9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
Expand Down Expand Up @@ -128,11 +132,10 @@ jobs:
working-directory: "./flutter-example"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: npm install -g appcenter-cli
- run: gem install bundler
- working-directory: flutter-example
run: bundler install
- uses: subosito/flutter-action@v2
with:
# Do _NOT_ use the latest stable as those contain breaking changes
Expand Down Expand Up @@ -169,19 +172,17 @@ jobs:
run: |
BUILD_NUMBER=$(date +%s)
flutter build ipa --export-options-plist ./exportOptions.plist --build-number $BUILD_NUMBER
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.IOS_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "./build/ios/ipa/Authgear Flutter.ipa" --group "Collaborators" --app "Oursky/Authgear-Migrate-Tool-Xamarin-To-Flutter-Sample" --release-notes "flutter ios"
- name: Distribute to App Store Connect
run: bundle exec fastlane app_testflight
xamarin-ios:
runs-on: macos-12
needs: ["test-xamarin", "test-flutter"]
# needs: ["test-xamarin", "test-flutter"]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: gem install bundler
- working-directory: flutter-example
run: bundler install
- uses: actions/setup-dotnet@v3
with:
global-json-file: ./global.json
Expand Down Expand Up @@ -224,10 +225,14 @@ jobs:
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $BUILD_NUMBER" ./XamarinFormSample/XamarinFormSample.iOS/Info.plist
- name: msbuild
run: msbuild ./XamarinFormSample/XamarinFormSample.iOS/XamarinFormSample.iOS.csproj /p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true /t:Rebuild /p:IpaPackageDir="$RUNNER_TEMP"
- name: Distribute to App Center
- name: Setup App Store Connect
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.IOS_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "$RUNNER_TEMP/XamarinFormSample.iOS.ipa" --group "Collaborators" --app "Oursky/Authgear-Migrate-Tool-Xamarin-To-Flutter-Sample" --release-notes "xamarin ios"
IOS_FASTLANE_APP_STORE_CONNECT_API_KEY_JSON_BASE64: ${{ secrets.IOS_FASTLANE_APP_STORE_CONNECT_API_KEY_JSON_BASE64 }}
run: |
APP_STORE_CONNECT_API_KEY_FILE=$RUNNER_TEMP/app_store_connect_key.json
echo -n "$IOS_FASTLANE_APP_STORE_CONNECT_API_KEY_JSON_BASE64" | base64 --decode -o $APP_STORE_CONNECT_API_KEY_FILE
APP_IPA_FILE_PATH=$RUNNER_TEMP/XamarinFormSample.iOS.ipa
bundle exec fastlane app_testflight
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
Expand Down
3 changes: 3 additions & 0 deletions XamarinFormSample/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
18 changes: 18 additions & 0 deletions XamarinFormSample/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

default_platform(:ios)

platform :ios do
desc "Deploy app"
lane :app_deploy do |options|
app_testflight options
end

desc "Upload app to testflight"
lane :app_testflight do |options|
upload_to_testflight(
api_key_path: ENV['APP_STORE_CONNECT_API_KEY_FILE'],
ipa: ENV['APP_IPA_FILE_PATH']
skip_waiting_for_build_processing: true
)
end
end
3 changes: 3 additions & 0 deletions flutter-example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
17 changes: 17 additions & 0 deletions flutter-example/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

default_platform(:ios)

platform :ios do
desc "Deploy app"
lane :app_deploy do |options|
app_testflight options
end

desc "Upload app to testflight"
lane :app_testflight do |options|
upload_to_testflight(
api_key_path: ENV['APP_STORE_CONNECT_API_KEY_FILE'],
skip_waiting_for_build_processing: true
)
end
end

0 comments on commit dd26ff9

Please sign in to comment.