|
| 1 | +# Customise this file, documentation can be found here: |
| 2 | +# https://github.com/KrauseFx/fastlane/tree/master/docs |
| 3 | +# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md |
| 4 | +# can also be listed using the `fastlane actions` command |
| 5 | + |
| 6 | +# Change the syntax highlighting to Ruby |
| 7 | +# All lines starting with a # are ignored when running `fastlane` |
| 8 | + |
| 9 | +# By default, fastlane will send which actions are used |
| 10 | +# No personal data is shared, more information on https://github.com/fastlane/enhancer |
| 11 | +# Uncomment the following line to opt out |
| 12 | +# opt_out_usage |
| 13 | + |
| 14 | +# This is the minimum version number required. |
| 15 | +# Update this, if you use features of a newer version |
| 16 | +require 'yaml' |
| 17 | +require 'spaceship' |
| 18 | +require 'colored' |
| 19 | + |
| 20 | +fastlane_version "1.38.0" |
| 21 | + |
| 22 | +default_platform :ios |
| 23 | + |
| 24 | + |
| 25 | +SLACK_URL = "https://hooks.slack.com/services/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".freeze |
| 26 | +FRAMEWORK_NAME = "Diff".freeze |
| 27 | +REPOSITORY_NAME = "Diff.swift".freeze |
| 28 | + |
| 29 | +platform :ios do |
| 30 | + desc "Release new version" |
| 31 | + lane :release do |options| |
| 32 | + target_version = options[:version] |
| 33 | + raise "The version is missed. Use `fastlane release version:{version_number}`.`" if target_version.nil? |
| 34 | + |
| 35 | + ensure_git_branch |
| 36 | + ensure_git_status_clean |
| 37 | + |
| 38 | + # Increment version |
| 39 | + increment_version_number(version_number: target_version) |
| 40 | + |
| 41 | + # Create Carthage framework |
| 42 | + Actions.sh("cd .. && carthage build --no-skip-current && carthage archive #{FRAMEWORK_NAME}") |
| 43 | + framework_binary = File.join(File.expand_path('../..', __FILE__),"#{FRAMEWORK_NAME}.framework.zip") |
| 44 | + raise "No binary found to upload #{framework_binary}" if File.file?(framework_binary) == false |
| 45 | + |
| 46 | + git_add |
| 47 | + git_commit(path: ".", message: "New release version bump") |
| 48 | + |
| 49 | + # Create release tag |
| 50 | + push_to_git_remote |
| 51 | + |
| 52 | + set_github_release( |
| 53 | + repository_name: "LootApp/#{REPOSITORY_NAME}", |
| 54 | + api_token: ENV['GITHUB_API_TOKEN'], |
| 55 | + tag_name: target_version, |
| 56 | + upload_assets: [ framework_binary ], |
| 57 | + name: target_version, |
| 58 | + description: "Release of #{target_version}" |
| 59 | + ) |
| 60 | + |
| 61 | + File.delete(framework_binary) |
| 62 | + end |
| 63 | + |
| 64 | + error do |lane, exception| |
| 65 | + notification(subtitle: "Fastlane error", message: "Error in lane " + lane.to_s) |
| 66 | + end |
| 67 | +end |
| 68 | + |
| 69 | + |
| 70 | +# More information about multiple platforms in fastlane: |
| 71 | +# https://github.com/KrauseFx/fastlane/blob/master/docs/Platforms.md |
0 commit comments