@@ -240,6 +240,100 @@ def execute_lane_test(params)
240240 expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
241241 expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "1.0.9" )
242242 end
243+
244+ it "should handle tag without git describe suffix" do
245+ commits = [
246+ "fix: ...|"
247+ ]
248+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v5.7.0' )
249+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
250+
251+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v5.7.0' , debug : false )
252+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
253+ expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "5.7.1" )
254+ end
255+
256+ it "should handle hyphenated tag without git describe suffix" do
257+ commits = [
258+ "fix: ...|"
259+ ]
260+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v1.0.0-1-ios-beta' )
261+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
262+
263+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v1.0.0-1-ios-beta' , debug : false )
264+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
265+ expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "1.0.1" )
266+ end
267+
268+ it "should handle hyphenated tag with git describe suffix" do
269+ commits = [
270+ "fix: ...|"
271+ ]
272+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v1.0.0-1-ios-beta-3-gabc1234' )
273+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
274+
275+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v1.0.0-1-ios-beta' , debug : false )
276+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
277+ expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "1.0.1" )
278+ end
279+
280+ it "should handle prerelease tag (v1.0.0-beta) without git describe suffix" do
281+ commits = [
282+ "fix: ...|"
283+ ]
284+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v1.0.0-beta' )
285+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
286+
287+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v1.0.0-beta' , debug : false )
288+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
289+ end
290+
291+ it "should handle prerelease tag with git describe suffix" do
292+ commits = [
293+ "fix: ...|"
294+ ]
295+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v1.0.0-beta-3-gabc1234' )
296+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
297+
298+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v1.0.0-beta' , debug : false )
299+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
300+ end
301+
302+ it "should handle rc tag (v2.0.0-rc.1) with git describe suffix" do
303+ commits = [
304+ "fix: ...|"
305+ ]
306+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v2.0.0-rc.1-5-g1234abc' )
307+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
308+
309+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v2.0.0-rc.1' , debug : false )
310+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
311+ expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "2.0.1" )
312+ end
313+
314+ it "should handle release- prefix tag with git describe suffix" do
315+ commits = [
316+ "fix: ...|"
317+ ]
318+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'release-1.2.3-7-gdeadbeef' )
319+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
320+
321+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'release-1.2.3' , debug : false )
322+ expect ( execute_lane_test ( match : 'release-*' ) ) . to eq ( true )
323+ expect ( Fastlane ::Actions . lane_context [ Fastlane ::Actions ::SharedValues ::RELEASE_NEXT_VERSION ] ) . to eq ( "1.2.4" )
324+ end
325+
326+ it "should not strip suffix-like parts from tag name" do
327+ commits = [
328+ "fix: ...|"
329+ ]
330+ # Tag v1.0.0-3-beta ends in -3-beta which looks like a suffix but isn't (beta is not g-prefixed hex)
331+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag ) . and_return ( 'v1.0.0-3-beta' )
332+ allow ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_commits_from_hash ) . and_return ( commits )
333+
334+ expect ( Fastlane ::Actions ::AnalyzeCommitsAction ) . to receive ( :get_last_tag_hash ) . with ( tag_name : 'v1.0.0-3-beta' , debug : false )
335+ expect ( execute_lane_test ( match : 'v*' ) ) . to eq ( true )
336+ end
243337 end
244338
245339 it "should provide codepush last version" do
0 commit comments