Created
July 6, 2023 13:39
-
-
Save lukepighetti/f719f5fc040b85784158b23de46fe97f to your computer and use it in GitHub Desktop.
Release Flutter app with environment variables to TestFlight every night with GitHub Actions
This file contains hidden or 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
# ios/Fastlane/Fastfile | |
default_platform(:ios) | |
APPLE_ISSUER_ID = ENV["APPLE_ISSUER_ID"] | |
APPLE_KEY_CONTENT = ENV["APPLE_KEY_CONTENT"] | |
APPLE_KEY_ID = ENV["APPLE_KEY_ID"] | |
DEVELOPER_APP_ID = ENV["DEVELOPER_APP_ID"] | |
DEVELOPER_APP_IDENTIFIER = ENV["DEVELOPER_APP_IDENTIFIER"] | |
GIT_AUTHORIZATION = ENV["GIT_AUTHORIZATION"] | |
GITHUB_RUN_NUMBER = ENV["GITHUB_RUN_NUMBER"] | |
PROVISIONING_PROFILE_SPECIFIER = ENV["PROVISIONING_PROFILE_SPECIFIER"] | |
VERSION_NUMBER = ENV["VERSION_NUMBER"] | |
platform :ios do | |
lane :beta do | |
setup_ci() | |
api_key = app_store_connect_api_key( | |
issuer_id: APPLE_ISSUER_ID, | |
key_content: APPLE_KEY_CONTENT, | |
key_id: APPLE_KEY_ID, | |
) | |
cocoapods( | |
clean_install: true | |
) | |
match( | |
type: 'appstore', | |
app_identifier: DEVELOPER_APP_IDENTIFIER, | |
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION), | |
readonly: true, | |
api_key: api_key, | |
) | |
increment_version_number( | |
version_number: VERSION_NUMBER | |
) | |
increment_build_number( | |
build_number: GITHUB_RUN_NUMBER.to_i + 20 | |
) | |
gym( | |
configuration: "Release", | |
workspace: "Runner.xcworkspace", | |
scheme: "your_schema", | |
export_method: "app-store", | |
export_options: { | |
provisioningProfiles: { | |
DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER | |
} | |
} | |
) | |
pilot( | |
apple_id: DEVELOPER_APP_ID, | |
app_identifier: DEVELOPER_APP_IDENTIFIER, | |
ipa: "./Runner.ipa", | |
skip_waiting_for_build_processing: true, | |
) | |
end | |
end |
This file contains hidden or 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
# .github/workflows/testflight.yml | |
name: CD | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: Deploy to TestFlight | |
runs-on: macos-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- run: flutter pub get | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.2.0" | |
working-directory: "ios" | |
bundler-cache: true | |
- run: cd ios && bundle install | |
- run: flutter build ios --config-only --no-codesign --dart-define-from-file=config.staging.json | |
- uses: maierj/[email protected] | |
with: | |
lane: beta | |
subdirectory: "ios" | |
env: | |
APP_STORE_CONNECT_TEAM_ID: "${{ secrets.APP_STORE_CONNECT_TEAM_ID }}" | |
APPLE_ISSUER_ID: "${{ secrets.APPLE_ISSUER_ID }}" | |
APPLE_KEY_CONTENT: "${{ secrets.APPLE_KEY_CONTENT }}" | |
APPLE_KEY_ID: "${{ secrets.APPLE_KEY_ID }}" | |
DEVELOPER_APP_ID: "${{ secrets.DEVELOPER_APP_ID }}" | |
DEVELOPER_APP_IDENTIFIER: "${{ secrets.DEVELOPER_APP_IDENTIFIER }}" | |
DEVELOPER_PORTAL_TEAM_ID: "${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}" | |
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: "${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}" | |
FASTLANE_APPLE_ID: "${{ secrets.FASTLANE_APPLE_ID }}" | |
GIT_AUTHORIZATION: "${{ secrets.GIT_AUTHORIZATION }}" | |
GITHUB_RUN_NUMBER: "${{ github.run_number }}" | |
MATCH_PASSWORD: "${{ secrets.MATCH_PASSWORD }}" | |
PROVISIONING_PROFILE_SPECIFIER: "${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}" | |
VERSION_NUMBER: "1.0.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment