fastlane-plugin-auth0_shipper 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df3c0f0879a157ba8ecf469061f60ff21a747cff
4
- data.tar.gz: 845d910b8e38210c8aa7177f51b4c8d65b65c434
3
+ metadata.gz: e71dade066673d285625f378d3a6e8bd2308341a
4
+ data.tar.gz: 4ccf82a644dc762c545005e308b08ad0a2d7d72c
5
5
  SHA512:
6
- metadata.gz: 2ba7da908cdb542a37882556133fcc7c135c3a382b0e51b8eb4752512a26e538fb5d665411964f115c1a0eb390da3cbc0788eb55924ed8c2ab937aa16fb26019
7
- data.tar.gz: fc961022c448c53ce9d8a5f6af0fc78c401e76f9d40b52dd2871ce54cc0d594c3b58a43130c08bd0e2047fcb131c8800e7c42e0fcfeba4d92ac0b2efe331bb5b
6
+ metadata.gz: 231dd9f55935438f262ed20709c14f2d5290edebee4258a36f901c6ec5a7a7c8fcbac92a4122b3f94fc3f6b090b61c7ba14613d33227d945dae38e71d17c64bb
7
+ data.tar.gz: f31aa11d8d117961e2c3758cc4df195d3ed62380d87597b0806958c1bf11b94a864a48fb901a46a0473c9613ed02e918a0cfc6b36e6702ec1a0fd4a4dcad1b6e
@@ -0,0 +1,42 @@
1
+ module Fastlane
2
+ module Actions
3
+ class PerformReleaseAction < Action
4
+ def self.run(params)
5
+ version = Helper::Auth0ShipperHelper.resolve_current_version(params[:target])
6
+ UI.header "Performing release for version #{version} 🏗"
7
+ Actions::AddGitTagAction.run(tag: version.to_s)
8
+ Actions::PushToGitRemoteAction.run({tags: true})
9
+ end
10
+
11
+ def self.description
12
+ "Performs the release for an Auth0 OSS library"
13
+ end
14
+
15
+ def self.authors
16
+ ["Hernan Zalazar"]
17
+ end
18
+
19
+ def self.return_value
20
+
21
+ end
22
+
23
+ def self.details
24
+ "Performs the release of an Auth0 OSS library by creating a tag and pushing it to the remote, and creating the Github Release"
25
+ end
26
+
27
+ def self.available_options
28
+ [
29
+ FastlaneCore::ConfigItem.new(key: :target,
30
+ env_name: "AUTH0_SHIPPER_TARGET",
31
+ description: "Xcode target for the Library",
32
+ optional: true,
33
+ type: String)
34
+ ]
35
+ end
36
+
37
+ def self.is_supported?(platform)
38
+ [:ios].include?(platform)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,13 +4,17 @@ module Fastlane
4
4
  def self.run(params)
5
5
  Actions::EnsureGitStatusCleanAction.run({})
6
6
  UI.user_error!("Must specify if the release is major, minor or patch or the version number") if params[:bump].nil? && params[:version].nil?
7
- current_version = Helper::Auth0ShipperHelper.resolve_current_version
7
+ current_version = Helper::Auth0ShipperHelper.resolve_current_version(params[:target])
8
8
  if params[:version].nil?
9
9
  next_version = Helper::Auth0ShipperHelper.calculate_next_version(current_version, params[:bump])
10
10
  else
11
11
  next_version = Helper::Auth0ShipperHelper.wrap_version params[:version]
12
12
  end
13
13
  UI.header "Preparing release for version #{next_version} 🏗"
14
+ release_branch = Helper::Auth0ShipperHelper.release_branch_name(params[:release_branch], next_version)
15
+ UI.user_error!("There is a local or remote branch named #{release_branch}. Please remove it or pick a different name for this release") if Helper::Auth0ShipperHelper.release_branch_exists(release_branch)
16
+ UI.message "Using release branch #{release_branch}"
17
+ Helper::Auth0ShipperHelper.create_release_branch(release_branch)
14
18
  changelog_entry = Helper::Auth0ShipperHelper.prepare_changelog(current_version, next_version, params[:organization], params[:repository])
15
19
  Helper::Auth0ShipperHelper.prepare_changelog_file(params[:changelog], changelog_entry)
16
20
  UI.message "\n#{changelog_entry}"
@@ -18,9 +22,18 @@ module Fastlane
18
22
  Helper::Auth0ShipperHelper.prepare_readme_file(params[:readme], current_version, next_version)
19
23
  Actions::GitAddAction.run(path: [params[:readme], params[:changelog]])
20
24
  Actions::IncrementVersionNumberAction.run(version_number: next_version.to_s)
21
- Actions::CommitVersionBumpAction.run(message: "Release #{next_version}", xcodeproj: params[:xcodeproj], force: true)
22
- Actions::AddGitTagAction.run(tag: next_version.to_s)
25
+ Actions::CommitVersionBumpAction.run(message: "Release #{next_version}", xcodeproj: params[:xcodeproj], include: [], force: true)
23
26
  UI.success "Release #{next_version} ready to be uploaded! 📦"
27
+ Actions::PushToGitRemoteAction.run({remote: 'origin', local_branch: release_branch}) unless params[:local_run]
28
+ Actions::CreatePullRequestAction.run({
29
+ api_token: params[:github_token],
30
+ repo: "#{params[:organization]}/#{params[:repository]}",
31
+ head: release_branch,
32
+ base: 'master',
33
+ title: "Release #{next_version}",
34
+ body: changelog_entry,
35
+ api_url: 'https://api.github.com'
36
+ }) unless params[:local_run] || params[:github_token].nil?
24
37
  next_version
25
38
  end
26
39
 
@@ -79,7 +92,28 @@ module Fastlane
79
92
  env_name: "AUTH0_SHIPPER_XCODEPROJ",
80
93
  description: "Xcode project file",
81
94
  optional: false,
82
- type: String)
95
+ type: String),
96
+ FastlaneCore::ConfigItem.new(key: :target,
97
+ env_name: "AUTH0_SHIPPER_TARGET",
98
+ description: "Xcode target for the Library",
99
+ optional: true,
100
+ type: String),
101
+ FastlaneCore::ConfigItem.new(key: :release_branch,
102
+ env_name: "AUTH0_SHIPPER_RELEASE_BRANCH",
103
+ description: "Name of the release branch to use",
104
+ optional: true,
105
+ type: String),
106
+ FastlaneCore::ConfigItem.new(key: :github_token,
107
+ env_name: "AUTH0_SHIPPER_GITHUB_TOKEN",
108
+ description: "Github token to create Pull Request",
109
+ optional: true,
110
+ type: String),
111
+ FastlaneCore::ConfigItem.new(key: :local_run,
112
+ env_name: "AUTH0_SHIPPER_LOCAL_RUN",
113
+ description: "Avoid pushing changes to remote repository",
114
+ default_value: false,
115
+ optional: true,
116
+ type: Boolean)
83
117
  ]
84
118
  end
85
119
 
@@ -4,8 +4,15 @@ module Fastlane
4
4
  def self.run(params)
5
5
  tag = Actions::LastGitTagAction.run({})
6
6
  UI.header "Publishing release #{tag} 📨"
7
+ changelog_entry = Helper::Auth0ShipperHelper.get_changelog(tag.to_s, params[:changelog])
8
+ Actions::SetGithubReleaseAction.run({
9
+ repository_name: "#{params[:organization]}/#{params[:repository]}",
10
+ api_token: params[:github_token],
11
+ name: tag.to_s,
12
+ tag_name: tag.to_s,
13
+ description: changelog_entry
14
+ }) unless params[:github_token].nil?
7
15
  Actions::PodLibLintAction.run({})
8
- Actions::PushToGitRemoteAction.run({remote: 'origin', tags: true})
9
16
  Actions::PodPushAction.run({})
10
17
  UI.success "Shipped #{tag}! 🚀"
11
18
  end
@@ -27,7 +34,30 @@ module Fastlane
27
34
  end
28
35
 
29
36
  def self.available_options
30
- []
37
+ [
38
+ FastlaneCore::ConfigItem.new(key: :organization,
39
+ env_name: "AUTH0_SHIPPER_ORGANIZATION",
40
+ description: "Github organization where the library is available",
41
+ default_value: "auth0",
42
+ optional: true,
43
+ type: String),
44
+ FastlaneCore::ConfigItem.new(key: :repository,
45
+ env_name: "AUTH0_SHIPPER_REPOSITORY",
46
+ description: "Github repository name where the library is available",
47
+ optional: false,
48
+ type: String),
49
+ FastlaneCore::ConfigItem.new(key: :github_token,
50
+ env_name: "AUTH0_SHIPPER_GITHUB_TOKEN",
51
+ description: "Github token to create Pull Request",
52
+ optional: true,
53
+ type: String),
54
+ FastlaneCore::ConfigItem.new(key: :changelog,
55
+ env_name: "AUTH0_SHIPPER_CHANGELOG",
56
+ description: "Path to the CHANGELOG file",
57
+ default_value: "CHANGELOG.md",
58
+ optional: true,
59
+ type: String)
60
+ ]
31
61
  end
32
62
 
33
63
  def self.is_supported?(platform)
@@ -11,8 +11,8 @@ module Fastlane
11
11
  Semantic::Version.new version
12
12
  end
13
13
 
14
- def self.ios_current_version
15
- current_version_number = Actions::GetVersionNumberAction.run({})
14
+ def self.ios_current_version(target)
15
+ current_version_number = Actions::GetVersionNumberAction.run({target: target})
16
16
  UI.user_error!("Cannot find current version number from .xcodeproj") if current_version_number.nil?
17
17
  Semantic::Version.new current_version_number
18
18
  end
@@ -22,8 +22,8 @@ module Fastlane
22
22
  Semantic::Version.new tag.to_s unless tag.nil?
23
23
  end
24
24
 
25
- def self.resolve_current_version
26
- current_version_plist = ios_current_version
25
+ def self.resolve_current_version(target)
26
+ current_version_plist = ios_current_version(target)
27
27
  current_version_tag = tag_current_version
28
28
  current_version = current_version_plist
29
29
  current_version = UI.select("Please select current version", [current_version_plist, current_version_tag]) unless current_version_tag.nil? || (current_version_plist == current_version_tag)
@@ -45,6 +45,25 @@ module Fastlane
45
45
  changelog
46
46
  end
47
47
 
48
+ def self.get_changelog(version, filename)
49
+ lines = []
50
+ found = false
51
+ version_header = "## [#{version}]"
52
+ header_format = /\#\# \[.*\]\(https:\/\/github\.com/
53
+
54
+ File.open(filename) do | file |
55
+ while (line = file.gets) != nil do
56
+ is_version_header = line.strip.start_with? version_header
57
+ is_next_header = line.match(header_format) && !is_version_header && found
58
+ break if is_next_header
59
+ found = true if is_version_header
60
+ lines << line.strip if !is_version_header && found
61
+ end
62
+ end
63
+
64
+ string = lines.join "\n"
65
+ end
66
+
48
67
  def self.prepare_changelog_file(file, entry)
49
68
  File.write(f = file, File.read(f).gsub(/# Change Log/, entry))
50
69
  end
@@ -52,6 +71,24 @@ module Fastlane
52
71
  def self.prepare_readme_file(file_name, current, next_version)
53
72
  File.write(f = file_name, File.read(f).gsub(/~> #{current.major}\.#{current.minor}/, "~> #{next_version.major}.#{next_version.minor}"))
54
73
  end
74
+
75
+ def self.release_branch_name(name, next_version)
76
+ branch_name = "release-#{next_version}"
77
+ branch_name = name unless name.nil?
78
+ branch_name
79
+ end
80
+
81
+ def self.create_release_branch(name)
82
+ system("git checkout -q -b #{name}")
83
+ end
84
+
85
+ def self.release_branch_exists(name)
86
+ system("git branch --list -a | grep -q #{name}")
87
+ end
88
+
89
+ def self.clean_release_branch(name, force)
90
+ system("git branch -q #{force ? '-D' : '-d'} #{name}")
91
+ end
55
92
  end
56
93
  end
57
94
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Auth0Shipper
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-auth0_shipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernan Zalazar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-16 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.0.3
103
+ version: 2.96.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.3
110
+ version: 2.96.1
111
111
  description:
112
112
  email: hernan.zalazar@gmail.com
113
113
  executables: []
@@ -117,11 +117,12 @@ files:
117
117
  - LICENSE
118
118
  - README.md
119
119
  - lib/fastlane/plugin/auth0_shipper.rb
120
+ - lib/fastlane/plugin/auth0_shipper/actions/perform_release_action.rb
120
121
  - lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb
121
122
  - lib/fastlane/plugin/auth0_shipper/actions/publish_release_action.rb
122
123
  - lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb
123
124
  - lib/fastlane/plugin/auth0_shipper/version.rb
124
- homepage:
125
+ homepage: https://github.com/auth0/fastlane-plugin-auth0_shipper
125
126
  licenses:
126
127
  - MIT
127
128
  metadata: {}
@@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  version: '0'
142
143
  requirements: []
143
144
  rubyforge_project:
144
- rubygems_version: 2.2.2
145
+ rubygems_version: 2.6.13
145
146
  signing_key:
146
147
  specification_version: 4
147
148
  summary: OSS libraries release process for Auth0