File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ def self.run(params)
8
8
require_relative '../../helper/release_notes_helper'
9
9
require_relative '../../helper/git_helper'
10
10
11
- path = File . join ( ENV [ 'PROJECT_ROOT_FOLDER' ] || '.' , 'RELEASE-NOTES.txt' )
11
+ path = params [ :release_notes_file_path ]
12
12
next_version = Fastlane ::Helper ::Ios ::VersionHelper . calc_next_release_version ( params [ :new_version ] )
13
13
14
14
Fastlane ::Helper ::ReleaseNotesHelper . add_new_section ( path : path , section_title : next_version )
@@ -35,6 +35,11 @@ def self.available_options
35
35
env_name : 'FL_IOS_UPDATE_RELEASE_NOTES_VERSION' ,
36
36
description : 'The version we are currently freezing; An empty entry for the _next_ version after this one will be added to the release notes' ,
37
37
is_string : true ) ,
38
+ FastlaneCore ::ConfigItem . new ( key : :release_notes_file_path ,
39
+ env_name : 'FL_IOS_UPDATE_RELEASE_NOTES_FILE_PATH' ,
40
+ description : 'The path to the release notes file to be updated' ,
41
+ is_string : true ,
42
+ default_value : File . join ( ENV [ 'PROJECT_ROOT_FOLDER' ] || '.' , 'RELEASE-NOTES.txt' ) ) ,
38
43
]
39
44
end
40
45
Original file line number Diff line number Diff line change 2
2
3
3
describe Fastlane ::Actions ::IosUpdateReleaseNotesAction do
4
4
let ( :release_notes_txt ) { File . join ( File . dirname ( __FILE__ ) , 'RELEASE-NOTES.txt' ) }
5
+ let ( :changelog_md ) { File . join ( File . dirname ( __FILE__ ) , 'CHANGELOG.md' ) }
5
6
6
7
after do
7
- FileUtils . remove_entry release_notes_txt
8
+ FileUtils . rm ( [ release_notes_txt , changelog_md ] , force : true )
8
9
end
9
10
10
11
describe '#ios_update_release_notes' do
11
12
it 'adds a new section on RELEASE-NOTES.txt' do
12
13
# Arrange
13
-
14
14
ENV [ 'PROJECT_ROOT_FOLDER' ] = File . dirname ( __FILE__ )
15
15
File . write ( release_notes_txt , '' )
16
16
22
22
# Assert
23
23
expect ( File . read ( release_notes_txt ) ) . to eq ( "1.1\n -----\n \n \n " )
24
24
end
25
+
26
+ it 'adds a new section on the given file' do
27
+ # Arrange
28
+ ENV [ 'PROJECT_ROOT_FOLDER' ] = File . dirname ( __FILE__ )
29
+ File . write ( changelog_md , '' )
30
+
31
+ # Act
32
+ run_described_fastlane_action (
33
+ new_version : '1.0' ,
34
+ release_notes_file_path : changelog_md
35
+ )
36
+
37
+ # Assert
38
+ expect ( File . read ( changelog_md ) ) . to eq ( "1.1\n -----\n \n \n " )
39
+ end
25
40
end
26
41
end
You can’t perform that action at this time.
0 commit comments