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 10, 2024
1 parent 97a2874 commit e96ce4b
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 17 deletions.
40 changes: 23 additions & 17 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 @@ -85,7 +89,7 @@ jobs:
- name: Set Xamarin SDK versions
run: |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=16.2 --android=13.2
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=17 --android=13.2
- name: nuget restore
run: |
nuget restore ./XamarinFormSample/XamarinFormSample/XamarinFormSample.csproj
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: bundle install
- uses: actions/setup-dotnet@v3
with:
global-json-file: ./global.json
Expand All @@ -191,7 +192,7 @@ jobs:
- name: Set Xamarin SDK versions
run: |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=16.2 --android=13.2
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=17 --android=13.2
- run: sudo xcode-select -s /Applications/Xcode_14.2.app/Contents/Developer
- name: nuget restore
run: |
Expand Down Expand Up @@ -224,10 +225,15 @@ 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: Distribute to App Store Connect
working-directory: XamarinFormSample
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: |
export APP_STORE_CONNECT_API_KEY_FILE=$RUNNER_TEMP/app_store_connect_key.json
export APP_IPA_FILE_PATH=$RUNNER_TEMP/XamarinFormSample.iOS.ipa
echo -n "$IOS_FASTLANE_APP_STORE_CONNECT_API_KEY_JSON_BASE64" | base64 --decode -o $APP_STORE_CONNECT_API_KEY_FILE
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"
6 changes: 6 additions & 0 deletions XamarinFormSample/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username


# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
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 e96ce4b

Please sign in to comment.