Skip to content

Commit 06c80f0

Browse files
committed
Sort tags by creation date and not by refname
1 parent d8b7263 commit 06c80f0

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/fastlane/plugin/ddg_apple_automation/helper/git_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def self.untagged_commit_sha(release_branch, platform)
7474
end
7575

7676
def self.release_branch_state(release_branch, platform)
77-
latest_tag = `git tag --sort=-v:refname | grep '+#{platform}' | head -n 1`.chomp
77+
latest_tag = `git tag --sort=-creatordate | grep '+#{platform}' | head -n 1`.chomp
7878
latest_tag_sha = commit_sha_for_tag(latest_tag)
7979
release_branch_sha = `git rev-parse "origin/#{release_branch}"`.chomp
8080

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Fastlane
22
module DdgAppleAutomation
3-
VERSION = "3.1.0"
3+
VERSION = "3.1.1"
44
end
55
end

spec/git_helper_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def validate_semver(version)
489489

490490
context "when the release branch has no changes since the latest tag" do
491491
it "returns false and shows a message" do
492-
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-v:refname | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
492+
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-creatordate | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
493493
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git rev-parse \"#{version}\"^{}").and_return("abc123\n")
494494
allow(Fastlane::Helper::GitHelper).to receive(:`).with('git rev-parse "origin/release_branch"').and_return("abc123\n")
495495

@@ -500,7 +500,7 @@ def validate_semver(version)
500500

501501
context "when the release branch has changes since the latest tag" do
502502
it "returns true" do
503-
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-v:refname | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
503+
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-creatordate | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
504504
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git rev-parse \"#{version}\"^{}").and_return("abc123\n")
505505
allow(Fastlane::Helper::GitHelper).to receive(:`).with('git rev-parse "origin/release_branch"').and_return("def456\n")
506506
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git diff --name-only \"#{version}\"..\"origin/release_branch\"").and_return("app/file1.rb\napp/file2.rb\n")
@@ -510,7 +510,7 @@ def validate_semver(version)
510510

511511
context "when changes are only in scripts or workflows" do
512512
it "returns false" do
513-
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-v:refname | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
513+
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git tag --sort=-creatordate | grep '+#{platform}' | head -n 1").and_return("#{version}\n")
514514
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git rev-parse \"#{version}\"^{}").and_return("abc123\n")
515515
allow(Fastlane::Helper::GitHelper).to receive(:`).with('git rev-parse "origin/release_branch"').and_return("def456\n")
516516
allow(Fastlane::Helper::GitHelper).to receive(:`).with("git diff --name-only \"#{version}\"..\"origin/release_branch\"").and_return(".github/workflows/workflow.yml\nscripts/deploy.sh\nfastlane/Fastfile\n")

0 commit comments

Comments
 (0)