Last active
July 22, 2024 07:24
-
-
Save Grohden/147703e86bab7fe38db49a8b58733c6c to your computer and use it in GitHub Desktop.
Release Flutter fastlane + azure pipelines (based on chimon2000/03b0fb1fa2f96c5933e3c9cb1ba59bc7 gist)
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
package_name("com.foo.bar") |
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
# This file contains the fastlane.tools configuration | |
# You can find the documentation at https://docs.fastlane.tools | |
# | |
# For a list of all available actions, check out | |
# | |
# https://docs.fastlane.tools/actions | |
# | |
# For a list of all available plugins, check out | |
# | |
# https://docs.fastlane.tools/plugins/available-plugins | |
# | |
# Uncomment the line if you want fastlane to automatically update itself | |
# update_fastlane | |
default_platform(:android) | |
platform :android do | |
desc "Runs a clean flutter build" | |
lane :build_flutter do | |
Dir.chdir "../.." do | |
sh("flutter", "clean") | |
sh("flutter", "packages", "get") | |
sh("flutter", "packages", "pub", "run", "build_runner", "build", "--delete-conflicting-outputs") | |
sh("flutter", "build", "appbundle") | |
end | |
end | |
desc "Deploy a new beta build to Google Play" | |
lane :beta do | |
build_flutter | |
upload_to_play_store( | |
track: 'beta', | |
aab: '../build/app/outputs/bundle/release/app-release.aab' | |
) | |
end | |
end |
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
# The bundle identifier of your app | |
app_identifier("com.foo.bar") | |
# Your Apple email address | |
apple_id("[email protected]") | |
itc_team_id("FOO") # App Store Connect Team ID | |
team_id("FOO") # Developer Portal Team ID | |
# For more information about the Appfile, see: | |
# https://docs.fastlane.tools/advanced/#appfile |
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
# This file contains the fastlane.tools configuration | |
# You can find the documentation at https://docs.fastlane.tools | |
# | |
# For a list of all available actions, check out | |
# | |
# https://docs.fastlane.tools/actions | |
# | |
# For a list of all available plugins, check out | |
# | |
# https://docs.fastlane.tools/plugins/available-plugins | |
# | |
# Uncomment the line if you want fastlane to automatically update itself | |
# update_fastlane | |
default_platform(:ios) | |
MATCH_GIT_BEARER_AUTHORIZATION = ENV["MATCH_GIT_BEARER_AUTHORIZATION"] | |
TEMP_KEYCHAIN_NAME_DEFAULT = ENV['TEMP_KEYCHAIN_NAME'] || "fastlane_flutter" | |
TEMP_KEYCHAIN_PASSWORD_DEFAULT = ENV['TEMP_KEYCHAIN_PASSWORD'] || "temppassword" | |
def delete_temp_keychain(name) | |
delete_keychain( | |
name: name | |
) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db") | |
end | |
def create_temp_keychain(name, password) | |
create_keychain( | |
name: name, | |
password: password, | |
unlock: false, | |
timeout: false | |
) | |
end | |
def ensure_temp_keychain(name, password) | |
delete_temp_keychain(name) | |
create_temp_keychain(name, password) | |
end | |
platform :ios do | |
desc "Runs a clean flutter build" | |
lane :build_flutter do | |
Dir.chdir "../.." do | |
sh("flutter", "clean") | |
sh("flutter", "packages", "get") | |
sh("flutter", "packages", "pub", "run", "build_runner", "build", "--delete-conflicting-outputs") | |
sh("flutter", "build", "ios", "--release", "--no-codesign") | |
end | |
end | |
desc "Push a new beta build to TestFlight" | |
lane :beta do | |
ensure_temp_keychain(TEMP_KEYCHAIN_NAME_DEFAULT, TEMP_KEYCHAIN_PASSWORD_DEFAULT) | |
match( | |
app_identifier: "com.foo.bar", | |
type: "appstore", | |
keychain_name: TEMP_KEYCHAIN_NAME_DEFAULT, | |
keychain_password: TEMP_KEYCHAIN_PASSWORD_DEFAULT, | |
readonly: true | |
) | |
build_flutter | |
build_app(workspace: "Runner.xcworkspace", scheme: "Runner") | |
upload_to_testflight( | |
apple_id: "APPLE ID NUMBER", # replace this with the app id provided by apple | |
skip_waiting_for_build_processing: true | |
) | |
delete_temp_keychain(TEMP_KEYCHAIN_NAME_DEFAULT) | |
end | |
end |
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
git_url("https://#{ENV['AZURE_TOKEN']}@dev.azure.com/[org]/[project]/_git/[repo]") | |
storage_mode("git") | |
# The default type, can be: appstore, adhoc, enterprise or development | |
type("development") | |
app_identifier(["com.foo.bar"]) | |
username("[email protected]") # Your Apple Developer Portal username | |
# For all available options run `fastlane match --help` | |
# Remove the # in the beginning of the line to enable the other options | |
# The docs are available on https://docs.fastlane.tools/actions/match |
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
trigger: | |
- none | |
pool: | |
vmImage: 'macos-latest' | |
# Variables needed for this script | |
# JKS_FILE - JKS file encoded as base64 | |
# KEY_PROPS_FILE - A configured keyprops for jks, also encoded as base64 | |
# SUPPLY_JSON_KEY_DATA - This file is a google play console api auth key | |
# obtained here (https://play.google.com/apps/publish/#ApiAccessPlace) | |
steps: | |
# We use beta for now - until web comes out. | |
- task: FlutterInstall@0 | |
displayName: 'Flutter install' | |
inputs: | |
channel: 'beta' | |
version: 'latest' | |
- script: | | |
echo '##vso[task.prependpath]$(FlutterToolPath)' | |
echo '##vso[task.prependpath]$(FlutterToolPath)/cache/dart-sdk/bin' | |
displayName: 'Put flutter and dart in path' | |
- script: | | |
cd android | |
echo "$JKS_FILE" | base64 --decode > app/app-key.jks | |
echo "$KEY_PROPS_FILE" | base64 --decode > key.properties | |
displayName: 'Create key files for android' | |
env: | |
JKS_FILE: $(JKS_FILE) | |
KEY_PROPS_FILE: $(KEY_PROPS_FILE) | |
- script: | | |
cd android | |
fastlane beta --verbose | |
displayName: 'Run fastlane' | |
env: | |
SUPPLY_JSON_KEY_DATA: $(SUPPLY_JSON_KEY_DATA) |
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
trigger: | |
- none | |
pool: | |
vmImage: 'macos-latest' | |
# Variables needed for this script | |
# MATCH_PASSWORD - Match password used to decript certs repo | |
# AZURE_TOKEN AZURE_TOKEN - Personal access token for azure | |
# which can be obtained on https://dev.azure.com/nginformatica/_usersSettings/tokens | |
# FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD - App specific password | |
# this is provided by your apple account and it's used | |
# to publish the app in the appstore | |
# https://appleid.apple.com/account/manage | |
steps: | |
# We use beta for now - until web comes out. | |
- task: FlutterInstall@0 | |
displayName: 'Flutter install' | |
inputs: | |
channel: 'beta' | |
version: 'latest' | |
- script: | | |
echo '##vso[task.prependpath]$(FlutterToolPath)' | |
echo '##vso[task.prependpath]$(FlutterToolPath)/cache/dart-sdk/bin' | |
displayName: 'Put flutter and dart in path' | |
- script: | | |
cd ios | |
fastlane beta --verbose | |
displayName: 'Run fastlane beta' | |
env: | |
MATCH_PASSWORD: $(MATCH_PASSWORD) | |
AZURE_TOKEN: $(AZURE_TOKEN) | |
FASTLANE_PASSWORD: $(FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD) | |
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: $(FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment