Last active
March 4, 2020 07:36
-
-
Save elpsk/7de47a2f7d8864802000d9d3ebf4a3d1 to your computer and use it in GitHub Desktop.
Gitlab-ci.yml and Fastlane
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
# update_fastlane | |
default_platform(:ios) | |
platform :ios do | |
def build_appname( configuration, schema, export_method ) | |
build_app( | |
workspace: "appname.xcworkspace", | |
configuration: configuration, | |
scheme: schema, | |
silent: true, | |
clean: true, | |
include_symbols: true, | |
include_bitcode: true, | |
export_method: export_method, | |
output_directory: "build/", | |
output_name: "appnameApp.ipa", | |
suppress_xcode_output: true, | |
) | |
end | |
def deploy_appname( testerGroup, teamId, teamName ) | |
changelog = File.read("../RELEASE_NOTES.txt") | |
upload_to_testflight( | |
changelog: changelog, | |
username: "service-account@email.com", | |
skip_submission: false, | |
notify_external_testers: true, | |
distribute_external: true, | |
beta_app_description: "APPSTORE release", | |
groups: testerGroup, | |
skip_waiting_for_build_processing: false, | |
ipa: '/tmp/appnameApp.ipa', | |
team_id: teamId, | |
team_name: teamName | |
) | |
end | |
def firebase_deploy( group, appId ) | |
changelog = File.read("../RELEASE_NOTES.txt") | |
firebase_app_distribution( | |
app: appId, | |
release_notes: changelog, | |
ipa_path: '/tmp/appnameApp.ipa', | |
groups: group | |
) | |
end | |
# ------------------------------------------------------ | |
### BUILD | |
# ------------------------------------------------------ | |
lane :dev_eu do | |
build_appname( "Release-DEV", "Target-1", "enterprise" ) ### enterprise certificate | |
end | |
lane :qlt_eu do | |
build_appname( "Release-QLT", "Target-1", "enterprise" ) ### enterprise certificate | |
end | |
lane :prd_eu do | |
build_appname( "Release-PRD", "Target-1", "app-store" ) ### distribution certificate | |
end | |
lane :dev_usa do | |
build_appname( "Release-DEV", "Target-2", "app-store" ) ### distribution certificate | |
end | |
lane :qlt_usa do | |
build_appname( "Release-QLT", "Target-2", "app-store" ) ### distribution certificate | |
end | |
lane :prd_usa do | |
build_appname( "Release-PRD", "Target-2", "app-store" ) ### distribution certificate | |
end | |
# ------------------------------------------------------ | |
### DEPLOY | |
# ------------------------------------------------------ | |
lane :dev_eu_deploy do | |
# deploy_appname( "DEV-EU-Testers", "XXXXXX", "Company A S.p.A." ) ### account enterprise | |
firebase_deploy( "DEV-EU-Testers", "XXXXXX" ) | |
end | |
lane :qlt_eu_deploy do | |
# deploy_appname( "QLT-EU-Testers", "XXXXXX", "Company A S.p.A." ) ### account enterprise | |
firebase_deploy( "QLT-EU-Testers", "XXXXXX" ) | |
end | |
lane :prd_eu_deploy do | |
deploy_appname( "PRD-EU-Testers", "YYYYYY", "Company B S.p.A." ) ### account distribution | |
end | |
# ------------------------------------------------------ | |
lane :dev_usa_deploy do | |
deploy_appname( "DEV-USA-Testers", "ZZZZZZ", "Company C S.p.A." ) ### account distribution | |
end | |
lane :qlt_usa_deploy do | |
deploy_appname( "QLT-USA-Testers", "ZZZZZZ", "Company C S.p.A." ) ### account distribution | |
end | |
lane :prd_usa_deploy do | |
deploy_appname( "PRD-USA-Testers", "ZZZZZZ", "Company C S.p.A." ) ### account distribution | |
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
#------------------------------------------------------------------------------------------------ | |
stages: | |
- build | |
- deploy | |
#------------------------------------------------------------------------------------------------ | |
# BUILD | |
#------------------------------------------------------------------------------------------------ | |
build_eu_app-dev: &build_app | |
before_script: | |
- pod repo update | |
- pod check || pod install ### install pods if needed | |
stage: build | |
script: | |
- fastlane $CI_ENVIRONMENT_NAME | |
- cp build/appName.ipa /tmp/appName.ipa ### copy the build to /tmp for fast deploy | |
after_script: | |
- yes | rm -rf /Users/appName/Library/Developer/Xcode/Archives/ ### clean local storage | |
- yes | rm -rf /Users/appName/Library/Developer/Xcode/DerivedData/ ### clean local storage | |
artifacts: | |
paths: | |
- build/ | |
environment: | |
name: dev_eu | |
tags: | |
- macos ### use local machine | |
build_eu_app-qlt: | |
<<: *build_app | |
when: manual | |
environment: | |
name: qlt_eu | |
build_eu_app-prd: | |
<<: *build_app | |
when: manual | |
environment: | |
name: prd_eu | |
#------------------------------------------------------------------------------------------------ | |
build_usa_app-dev: | |
<<: *build_app | |
when: manual | |
environment: | |
name: dev_usa | |
build_usa_app-qlt: | |
<<: *build_app | |
when: manual | |
environment: | |
name: qlt_usa | |
build_usa_app-prd: | |
<<: *build_app | |
when: manual | |
environment: | |
name: prd_usa | |
#------------------------------------------------------------------------------------------------ | |
# DEPLOY | |
#------------------------------------------------------------------------------------------------ | |
deploy_eu_app-dev: &deploy_app | |
stage: deploy | |
only: | |
- master | |
script: | |
- fastlane $CI_ENVIRONMENT_NAME | |
after_script: | |
- yes | rm -rf /tmp/appName.ipa ### clean deployed local IPA | |
environment: | |
name: dev_eu_deploy | |
dependencies: | |
- build_eu_app-dev | |
tags: | |
- macos | |
deploy_eu_app-qlt: | |
<<: *deploy_app | |
when: manual | |
environment: | |
name: qlt_eu_deploy | |
dependencies: | |
- build_eu_app-qlt | |
deploy_eu_app-prd: | |
<<: *deploy_app | |
when: manual | |
environment: | |
name: prd_eu_deploy | |
dependencies: | |
- build_eu_app-prd | |
#------------------------------------------------------------------------------------------------ | |
deploy_usa_app-dev: | |
<<: *deploy_app | |
when: manual | |
environment: | |
name: dev_usa_deploy | |
dependencies: | |
- build_usa_app-dev | |
deploy_usa_app-qlt: | |
<<: *deploy_app | |
when: manual | |
environment: | |
name: qlt_usa_deploy | |
dependencies: | |
- build_usa_app-qlt | |
deploy_usa_app-prd: | |
<<: *deploy_app | |
when: manual | |
environment: | |
name: prd_usa_deploy | |
dependencies: | |
- build_usa_app-prd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment