Skip to content

Instantly share code, notes, and snippets.

@viteinfinite
Last active February 27, 2016 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viteinfinite/55e6d158172a4b46dff7 to your computer and use it in GitHub Desktop.
Save viteinfinite/55e6d158172a4b46dff7 to your computer and use it in GitHub Desktop.
Xebia's Blog Fastfile Example
# Definit le bundle identifier
app_identifier "fr.xebia.monAppli"
# Definit l'Apple ID du compte associé au compte de l'appli
apple_id "xxx@xebia.fr"
fastlane_version "1.46.1"
default_platform :ios
platform :ios do
# Enregistre les paramètres globaux
before_all do
# Slack
ENV["SLACK_URL"] = "XXX"
# Crashlytics / Fabric
ENV["CRASHLYTICS_API_TOKEN"] = "XXX"
ENV["CRASHLYTICS_BUILD_SECRET"] = "XXX"
ENV["CRASHLYTICS_EMAILS"] = "XXX"
ENV["CRASHLYTICS_GROUPS"] = "XXX"
# Projet Xcode pour la montée de version
ENV["FL_BUILD_NUMBER_PROJECT"] = "MonAppli.xcodeproj"
# Compilation (gym)
# Nous explicitons le répertoire DerivedData afin de pouvoir facilement
# effacer les artifacts temporaires du build
ENV["GYM_OUTPUT_DIRECTORY"] = "./DerivedData/"
ENV["GYM_ARCHIVE_PATH"] = "./DerivedData/"
end
# La lane de distribution
lane :distribute do
# Éxecute les tests
scan(code_coverage: true, xcargs: "-derivedDataPath ./DerivedData")
# Collecte (via Slather) le taux de couverture des tests
# L'action 'slather' est aussi disponible mais, à date, elle n'est pas à jour
sh("slather coverage --cobertura-xml --scheme MonAppli --output-directory ../artifacts --build-directory ../DerivedData ../MonAppli.xcodeproj")
# Crée une variable build_number et version_number, qui corréspond à la date courante
build_number = Time.new.strftime("%Y%m%d.%H%M")
version_number = Time.new.strftime("%Y.%m")
# Incrémente le numéro de version dans les métadonnées du projet Xcode
increment_build_number(build_number: build_number)
increment_version_number(version_number: version_number)
# Récupère le changelog à partir des commits
changelog = changelog_from_git_commits
# Vérifie et met à jour les certificats installés
sigh
# Compile l'application en utilisant les variables spécifiées
gym(scheme: MonAppli)
# Distribue l'application sur Fabric
crashlytics(notes: changelog)
# Notifie l'équipe via Slack
slack(message: "Successfully deployed new App Update.")
# Commit (git) automatiquement la version actuelle
commit_version_bump
# Push (git) automatiquement les modifications vers master
push_to_git_remote(local_branch: 'HEAD', remote_branch: 'master', force: true)
end
# Envoie un message d'erreur à Slack si besoin
error do |lane, exception|
slack(
message: exception.message,
success: false
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment