-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75ebdb5
commit 80725f3
Showing
10 changed files
with
212 additions
and
106 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,18 +11,13 @@ Gem::Specification.new do |spec| | |
spec.email = '[email protected]' | ||
|
||
spec.summary = 'Automates the steps to create a new release for a project.' | ||
# spec.homepage = "https://github.com/<GITHUB_USERNAME>/fastlane-plugin-release" | ||
spec.homepage = "https://github.com/Coledunsby/fastlane-plugin-release" | ||
spec.license = "MIT" | ||
|
||
spec.files = Dir["lib/**/*"] + %w(README.md LICENSE) | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ['lib'] | ||
|
||
# Don't add a dependency to fastlane or fastlane_re | ||
# since this would cause a circular dependency | ||
|
||
# spec.add_dependency 'your-dependency', '~> 1.0.0' | ||
|
||
spec.add_development_dependency('pry') | ||
spec.add_development_dependency('bundler') | ||
spec.add_development_dependency('rspec') | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
lane :test do | ||
release | ||
make_release | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
require 'fastlane/plugin/release/version' | ||
|
||
module Fastlane | ||
module Release | ||
# Return all .rb files inside the "actions" and "helper" directory | ||
def self.all_classes | ||
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))] | ||
module Release | ||
def self.all_classes | ||
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))] | ||
end | ||
end | ||
end | ||
end | ||
|
||
# By default we want to import all available actions and helpers | ||
# A plugin can contain any number of actions and plugins | ||
Fastlane::Release.all_classes.each do |current| | ||
require current | ||
require current | ||
end |
164 changes: 164 additions & 0 deletions
164
lib/fastlane/plugin/release/actions/make_release_action.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
require 'fastlane/action' | ||
require_relative '../helper/make_release_helper' | ||
|
||
module Fastlane | ||
|
||
module Actions | ||
|
||
class MakeReleaseAction < Action | ||
|
||
def self.run(params) | ||
|
||
other_action.ensure_git_branch(branch: params[:ensure_git_branch]) | ||
other_action.ensure_git_status_clean if params[:ensure_git_status_clean] | ||
|
||
xcodeproj = File.expand_path(params[:xcodeproj]) | ||
podspec = File.expand_path(params[:podspec]) | ||
version = params[:version] | ||
|
||
if version.nil? | ||
version = other_action.version_bump_podspec(path: podspec, bump_type: params[:version_bump_type]) | ||
else | ||
other_action.version_bump_podspec(path: podspec, version_number: version) | ||
end | ||
|
||
other_action.increment_version_number(version_number: version, xcodeproj: xcodeproj) | ||
other_action.increment_build_number(xcodeproj: xcodeproj) if params[:bump_build] | ||
other_action.commit_version_bump(include: [params[:podspec]]) | ||
other_action.add_git_tag(tag: params[:tag_prefix] + version) | ||
other_action.push_to_git_remote | ||
|
||
other_action.pod_push( | ||
path: podspec, | ||
repo: params[:podspec_repo], | ||
allow_warnings: params[:allow_warnings], | ||
sources: params[:sources] | ||
) | ||
|
||
version | ||
|
||
end | ||
|
||
def self.description | ||
"Automates the steps to create a new release for a framework." | ||
end | ||
|
||
def self.authors | ||
["Cole Dunsby"] | ||
end | ||
|
||
def self.return_value | ||
"The new version" | ||
end | ||
|
||
def self.details | ||
"Automates the steps to create a new release for a framework." | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new( | ||
key: :allow_warnings, | ||
env_name: "ALLOW_WARNINGS", | ||
default_value: true, | ||
description: "Allow warnings during pod push", | ||
optional: true, | ||
type: Boolean | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :bump_build, | ||
env_name: "BUMP_BUILD", | ||
default_value: false, | ||
description: "Will increment build number if enabled", | ||
optional: true, | ||
type: Boolean | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :ensure_git_branch, | ||
env_name: "ENSURE_GIT_BRANCH", | ||
default_value: "master", | ||
description: "The branch that should be checked for. String that can be either the full name of the branch or a regex to match", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :ensure_git_status_clean, | ||
env_name: "ENSURE_GIT_STATUS_CLEAN", | ||
default_value: true, | ||
description: "Raises an exception if there are uncommitted git changes", | ||
optional: true, | ||
type: Boolean | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :podspec, | ||
env_name: "PODSPEC", | ||
description: "The path of the podspec file to update", | ||
optional: false, | ||
type: String, | ||
verify_block: proc do |value| | ||
UI.user_error!("Could not find podspec at path '#{File.expand_path(value)}'") if !File.exist?(value) | ||
end | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :podspec_repo, | ||
env_name: "PODSPEC_REPO", | ||
default_value: "Trunk", | ||
description: "The repo you want to push. Pushes to Trunk by default", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :sources, | ||
env_name: "SOURCES", | ||
default_value: ["https://github.com/CocoaPods/Specs"], | ||
description: "The sources of repos you want the pod spec to lint with, separated by commas", | ||
optional: true, | ||
type: Array | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :tag_prefix, | ||
env_name: "TAG_PREFIX", | ||
default_value: "", | ||
description: "A prefix to be added to the version tag (e.g \"v/\")", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :version, | ||
env_name: "VERSION", | ||
conflicting_options: [:version_bump_type], | ||
description: "Change to a specific version. This will replace the bump type value", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :version_bump_type, | ||
env_name: "VERSION_BUMP_TYPE", | ||
conflicting_options: [:version], | ||
default_value: "patch", | ||
description: "The type of this version bump. Available: patch, minor, major", | ||
optional: true, | ||
type: String, | ||
verify_block: proc do |value| | ||
UI.user_error!("Available values are 'patch', 'minor' and 'major'") unless ['patch', 'minor', 'major'].include?(value) | ||
end | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :xcodeproj, | ||
env_name: "XCODEPROJ", | ||
description: "The path of the xcode project to update", | ||
optional: false, | ||
type: String, | ||
verify_block: proc do |value| | ||
UI.user_error!("Could not find xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) | ||
end | ||
) | ||
] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
[:ios, :mac].include?(platform) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'fastlane_core/ui/ui' | ||
|
||
module Fastlane | ||
|
||
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI") | ||
|
||
module Helper | ||
class MakeReleaseHelper | ||
|
||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Fastlane | ||
module Release | ||
VERSION = "0.1.0" | ||
end | ||
module Release | ||
VERSION = "0.1.0" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
describe Fastlane::Actions::ReleaseAction do | ||
describe Fastlane::Actions::MakeReleaseAction do | ||
describe '#run' do | ||
it 'prints a message' do | ||
expect(Fastlane::UI).to receive(:message).with("The release plugin is working!") | ||
|
||
Fastlane::Actions::ReleaseAction.run(nil) | ||
Fastlane::Actions::MakeReleaseAction.run(nil) | ||
end | ||
end | ||
end |