Skip to content

Commit

Permalink
Merge pull request xotahal#26 from thislooksfun/feature/allow-hyphen-…
Browse files Browse the repository at this point in the history
…suffix

fix: allow tags to contain hyphens
  • Loading branch information
xotahal authored Jun 28, 2020
2 parents e02da33 + b01eab2 commit e17b24c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ fastlane/README.md
fastlane/report.xml
coverage
test-results
.bundle/
vendor/bundle/
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def self.is_releasable(params)
else
# Tag's format is v2.3.4-5-g7685948
# See git describe man page for more info
tag_name = tag.split('-')[0].strip
tag_name = tag.split('-')[0...-2].join('-').strip
parsed_version = tag_name.match(params[:tag_version_match])

if parsed_version.nil?
Expand Down
28 changes: 28 additions & 0 deletions spec/analyze_commits_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,34 @@ def execute_lane_test(params)
expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::RELEASE_NEXT_VERSION]).to eq("1.0.10")
end

describe "tags" do
it "should properly strip off git describe suffix" do
commits = [
"docs: ...|",
"fix: ...|"
]
allow(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_last_tag).and_return('v1.0.8-1-g71ce4d8')
allow(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_commits_from_hash).and_return(commits)

expect(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_last_tag_hash).with(tag_name: 'v1.0.8', debug: false)
expect(execute_lane_test(match: 'v*')).to eq(true)
expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::RELEASE_NEXT_VERSION]).to eq("1.0.9")
end

it "should allow for user-defined hyphens" do
commits = [
"docs: ...|",
"fix: ...|"
]
allow(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_last_tag).and_return('ios-v1.0.8-beta.1-1-g71ce4d8')
allow(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_commits_from_hash).and_return(commits)

expect(Fastlane::Actions::AnalyzeCommitsAction).to receive(:get_last_tag_hash).with(tag_name: 'ios-v1.0.8-beta.1', debug: false)
expect(execute_lane_test(match: 'v*')).to eq(true)
expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::RELEASE_NEXT_VERSION]).to eq("1.0.9")
end
end

it "should provide codepush last version" do
commits = [
"fix: ...|codepush: ok",
Expand Down

0 comments on commit e17b24c

Please sign in to comment.