File tree Expand file tree Collapse file tree 5 files changed +139
-2
lines changed
lib/fastlane/plugin/wpmreleasetoolkit/actions Expand file tree Collapse file tree 5 files changed +139
-2
lines changed Original file line number Diff line number Diff line change 26
26
27
27
- Add ` tools:ignore="InconsistentArrays" ` to ` available_languages.xml ` to avoid a linter warning on repos hosting multiple app flavors. [ #390 ]
28
28
- Add the ability to provide a custom message for builds triggered via ` buildkite_trigger_build ` action [ #392 ]
29
+ - Add optional ` release_notes_file_path ` to ` ios_update_release_notes ` and ` android_update_release_notes ` [ #396 ]
29
30
30
31
### Bug Fixes
31
32
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 ::Android ::VersionHelper . calc_next_release_short_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_ANDROID_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_ANDROID_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 @@ -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
1
+ require 'spec_helper'
2
+
3
+ describe Fastlane ::Actions ::AndroidUpdateReleaseNotesAction do
4
+ let ( :new_section ) do
5
+ <<~CONTENT
6
+ 1.1
7
+ -----
8
+
9
+
10
+ CONTENT
11
+ end
12
+
13
+ let ( :content ) do
14
+ <<~CONTENT
15
+ 1.0
16
+ -----
17
+ - Item 1 for v1.0
18
+ - Item 2 for v1.0
19
+
20
+ // Comment in the middle
21
+
22
+ 0.9.0
23
+ -----
24
+ - Item 1 for v0.9.0
25
+ - Item 2 for v0.9.0
26
+ CONTENT
27
+ end
28
+
29
+ describe '#android_update_release_notes' do
30
+ it 'adds a new section on RELEASE-NOTES.txt' do
31
+ in_tmp_dir do |tmp_dir |
32
+ # Arrange
33
+ release_notes_txt = File . join ( tmp_dir , 'RELEASE-NOTES.txt' )
34
+ File . write ( release_notes_txt , content )
35
+
36
+ # Act
37
+ run_described_fastlane_action (
38
+ new_version : '1.0'
39
+ )
40
+
41
+ # Assert
42
+ expect ( File . read ( release_notes_txt ) ) . to eq ( new_section + content )
43
+ end
44
+ end
45
+
46
+ it 'adds a new section on the given file' do
47
+ in_tmp_dir do |tmp_dir |
48
+ # Arrange
49
+ changelog_md = File . join ( tmp_dir , 'CHANGELOG.md' )
50
+ File . write ( changelog_md , content )
51
+
52
+ # Act
53
+ run_described_fastlane_action (
54
+ new_version : '1.0' ,
55
+ release_notes_file_path : changelog_md
56
+ )
57
+
58
+ # Assert
59
+ expect ( File . read ( changelog_md ) ) . to eq ( new_section + content )
60
+ end
61
+ end
62
+ end
63
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Fastlane ::Actions ::IosUpdateReleaseNotesAction do
4
+ let ( :new_section ) do
5
+ <<~CONTENT
6
+ 1.1
7
+ -----
8
+
9
+
10
+ CONTENT
11
+ end
12
+
13
+ let ( :content ) do
14
+ <<~CONTENT
15
+ 1.0
16
+ -----
17
+ - Item 1 for v1.0
18
+ - Item 2 for v1.0
19
+
20
+ // Comment in the middle
21
+
22
+ 0.9.0
23
+ -----
24
+ - Item 1 for v0.9.0
25
+ - Item 2 for v0.9.0
26
+ CONTENT
27
+ end
28
+
29
+ describe '#ios_update_release_notes' do
30
+ it 'adds a new section on RELEASE-NOTES.txt' do
31
+ in_tmp_dir do |tmp_dir |
32
+ # Arrange
33
+ release_notes_txt = File . join ( tmp_dir , 'RELEASE-NOTES.txt' )
34
+ File . write ( release_notes_txt , content )
35
+
36
+ # Act
37
+ run_described_fastlane_action (
38
+ new_version : '1.0'
39
+ )
40
+
41
+ # Assert
42
+ expect ( File . read ( release_notes_txt ) ) . to eq ( new_section + content )
43
+ end
44
+ end
45
+
46
+ it 'adds a new section on the given file' do
47
+ in_tmp_dir do |tmp_dir |
48
+ # Arrange
49
+ changelog_md = File . join ( tmp_dir , 'CHANGELOG.md' )
50
+ File . write ( changelog_md , content )
51
+
52
+ # Act
53
+ run_described_fastlane_action (
54
+ new_version : '1.0' ,
55
+ release_notes_file_path : changelog_md
56
+ )
57
+
58
+ # Assert
59
+ expect ( File . read ( changelog_md ) ) . to eq ( new_section + content )
60
+ end
61
+ end
62
+ end
63
+ end
You can’t perform that action at this time.
0 commit comments