fastlane-plugin-unreleased_changelog 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +174 -0
- data/lib/fastlane/plugin/unreleased_changelog.rb +16 -0
- data/lib/fastlane/plugin/unreleased_changelog/actions/add_unreleased_changelog.rb +74 -0
- data/lib/fastlane/plugin/unreleased_changelog/actions/delete_unreleased_changelog.rb +82 -0
- data/lib/fastlane/plugin/unreleased_changelog/actions/ensure_unreleased_changelog.rb +78 -0
- data/lib/fastlane/plugin/unreleased_changelog/actions/get_unreleased_changelog.rb +61 -0
- data/lib/fastlane/plugin/unreleased_changelog/actions/stamp_unreleased_changelog.rb +71 -0
- data/lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb +42 -0
- data/lib/fastlane/plugin/unreleased_changelog/version.rb +5 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 36d75a12d7254c75179fcbf0363a9e3ed50eedd408537d7d9e1ba94c04218462
|
4
|
+
data.tar.gz: 4f04920c23a609199bdb7168e70da8490dc2630befdb342a85ddd555eb1a02bf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d7ecec368a1b86f072209bf27052d0a2e98d8eacdcc30bf68e3d9622a6ffe34a95a7c6cee79d33cd0f77d00373a71682515c03ab17b59ba166e1a67e984263f6
|
7
|
+
data.tar.gz: 4ec00341d2ffeb6e2270f708503e7011c7df23128f3b8149bfe72b0769cd6940a00ace0a934df3fff57662c5847976605e7d3742288eb5520cbe199477de28a9
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Manish Rathi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
## Fastlane `unreleased_changelog` plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-unreleased_changelog) [](https://twitter.com/manish_rathi_)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-unreleased_changelog`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin unreleased_changelog
|
11
|
+
```
|
12
|
+
|
13
|
+
## About unreleased_changelog
|
14
|
+
A fastlane plugin to manage unreleased changelog using a YML file. 🚀
|
15
|
+
|
16
|
+
This plugin is inspired by and based on [Keep a CHANGELOG](http://keepachangelog.com/) project. [Keep a CHANGELOG](http://keepachangelog.com/) proposes a standardised format for keeping change log of your project repository in `Changelog.yml` file. This file contains a curated, chronologically ordered list of notable changes for each version of a project in human readable format.
|
17
|
+
|
18
|
+
Since [Keep a CHANGELOG](http://keepachangelog.com/) project proposes a well-defined structure with _sections_ (e.g.: `[Unreleased]`, `[0.1.0]`) and _subsections_ (`Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`) it opens up an opportunity to automate reading from/writing to `Changelog.yml` with [`fastlane`](https://fastlane.tools).
|
19
|
+
|
20
|
+
## YML changlog file structure
|
21
|
+
`Changelog.yml` file must follow structure proposed by [Keep a CHANGELOG](http://keepachangelog.com/) project.
|
22
|
+
|
23
|
+
```yml
|
24
|
+
Unreleased:
|
25
|
+
Added:
|
26
|
+
- added new feature 1.1
|
27
|
+
- added new feature 2.1
|
28
|
+
Removed:
|
29
|
+
- removed deprecated feature XYZ
|
30
|
+
Fixed:
|
31
|
+
- bug-fix 3
|
32
|
+
[0.1.0-Release] - 2020-04-30:
|
33
|
+
Added:
|
34
|
+
- added new feature 1
|
35
|
+
- added new feature 2
|
36
|
+
Fixed:
|
37
|
+
- bug-fix 1
|
38
|
+
- bug-fix 2
|
39
|
+
```
|
40
|
+
|
41
|
+
## Actions
|
42
|
+
`fastlane-plugin-unreleased_changelog` consists of 5 actions enabling you to manipulate `Changelog.yml` from [`fastlane`](https://fastlane.tools).
|
43
|
+
|
44
|
+
### 🔎 ensure_unreleased_changelog
|
45
|
+
|
46
|
+
Ensures the content of the `Unreleased` section from your project's `Changelog.yml` file. Raises an exception if `Unreleased` section found empty, **print** the `Unreleased` section changelog if found.
|
47
|
+
|
48
|
+
``` ruby
|
49
|
+
ensure_unreleased_changelog # Raises an exception if `Unreleased` section is empty
|
50
|
+
```
|
51
|
+
|
52
|
+
``` ruby
|
53
|
+
ensure_unreleased_changelog(
|
54
|
+
file_name: 'custom_changelog_file_name', # Specify the custom YML changelog file name (dafault `changelog`)
|
55
|
+
show_diff: false # Show the `Unreleased` section changelog, if found. (dafault true)
|
56
|
+
)
|
57
|
+
```
|
58
|
+
|
59
|
+
### 📝 add_unreleased_changelog
|
60
|
+
|
61
|
+
Add a new entry inside your `Unreleased` section of your project's `Changelog.yml` file.
|
62
|
+
|
63
|
+
``` ruby
|
64
|
+
add_unreleased_changelog(
|
65
|
+
entry: "added new feature" # Add new changelog entry inside `Unreleased` section's `Addded` _subsections_
|
66
|
+
)
|
67
|
+
```
|
68
|
+
|
69
|
+
``` ruby
|
70
|
+
add_unreleased_changelog(
|
71
|
+
entry: "bug-fix 1", # New changelog entry for `Unreleased` section
|
72
|
+
type: "Fixed" # Add new changelog entry inside `Fixed` _subsections_ (dafault `Added`)
|
73
|
+
)
|
74
|
+
```
|
75
|
+
|
76
|
+
``` ruby
|
77
|
+
add_unreleased_changelog(
|
78
|
+
entry: "bug-fix 1", # New changelog entry for `Unreleased` section
|
79
|
+
type: "Fixed", # Add new changelog entry inside `Fixed` _subsections_ (dafault `Added`)
|
80
|
+
file_name: 'custom_changelog_file_name' # Specify the custom YML changelog file name (dafault `changelog`)
|
81
|
+
)
|
82
|
+
```
|
83
|
+
|
84
|
+
### ✂️ delete_unreleased_changelog
|
85
|
+
|
86
|
+
Delete an entry from your `Unreleased` section of your project's `Changelog.yml` file. Very handly, if your `Changelog.yml` contains Project tickets i.e JIRA ticket(s) etc and you want to automatically delete some changelog entry based on JIRA ticket number.
|
87
|
+
|
88
|
+
``` ruby
|
89
|
+
delete_unreleased_changelog(
|
90
|
+
entry: "some feature number" # Delete changelog entry from `Unreleased` section
|
91
|
+
)
|
92
|
+
```
|
93
|
+
|
94
|
+
``` ruby
|
95
|
+
delete_unreleased_changelog(
|
96
|
+
entry: "bug-fix 1", # Delete changelog entry from `Unreleased` section
|
97
|
+
file_name: 'custom_changelog_file_name' # Specify the custom YML changelog file name (dafault `changelog`)
|
98
|
+
)
|
99
|
+
```
|
100
|
+
|
101
|
+
### 📮get_unreleased_changelog
|
102
|
+
|
103
|
+
Get all the `Unreleased` section changelog of your project's `Changelog.yml` file. It will ruturn the Array for hash for `Unreleased` section's _subsections_ (`Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`). Based on your workflow you can do what-ever you want with `Unreleased` changelog. 💪🏻
|
104
|
+
|
105
|
+
``` ruby
|
106
|
+
get_unreleased_changelog
|
107
|
+
```
|
108
|
+
|
109
|
+
``` ruby
|
110
|
+
get_unreleased_changelog(
|
111
|
+
file_name: 'custom_changelog_file_name' # Specify the custom YML changelog file name (dafault `changelog`)
|
112
|
+
)
|
113
|
+
```
|
114
|
+
|
115
|
+
### 🕹stamp_unreleased_changelog
|
116
|
+
|
117
|
+
Stamps the `Unreleased` section with provided tag in your project `Changelog.yml` file and sets up a new `Unreleased` section above it for upcoming release.
|
118
|
+
|
119
|
+
``` ruby
|
120
|
+
stamp_unreleased_changelog(
|
121
|
+
tag: 'v0.1.0' # The tag, (usually a git-tag name) for stamping the `Unreleased` section
|
122
|
+
)
|
123
|
+
```
|
124
|
+
|
125
|
+
``` ruby
|
126
|
+
stamp_unreleased_changelog(
|
127
|
+
tag: 'v0.1.0', # The tag, (usually a git-tag name) for stamping the `Unreleased` section
|
128
|
+
file_name: 'custom_changelog_file_name' # Specify the custom YML changelog file name (dafault `changelog`)
|
129
|
+
)
|
130
|
+
```
|
131
|
+
|
132
|
+
## Example
|
133
|
+
|
134
|
+
You have to **remember to keep your Changelog.yml up-to-date** with whatever features, bug fixes etc. your repo contains and let [`fastlane`](https://fastlane.tools) do the rest.
|
135
|
+
|
136
|
+
``` ruby
|
137
|
+
desc "Upload a iOS beta build to Testflight with changelog."
|
138
|
+
lane :beta do
|
139
|
+
ensure_unreleased_changelog # Making sure changelog exist!
|
140
|
+
|
141
|
+
gym # Build the app and create .ipa file
|
142
|
+
|
143
|
+
changelog = get_unreleased_changelog # Get changelog
|
144
|
+
pilot(changelog: changelog) # Upload beta build to TestFlight with changelog
|
145
|
+
|
146
|
+
version_number = get_version_number # Get project version
|
147
|
+
build_number = get_build_number # Get build number
|
148
|
+
git_tag_name = "#{version_number}-#{build_number}-beta-release"
|
149
|
+
|
150
|
+
stamp_unreleased_changelog(tag: git_tag_name) # Stamp Unreleased section
|
151
|
+
git_commit(path: ".", message: "#{git_tag_name} Beta release") # git commit `Changelog.yml` file
|
152
|
+
|
153
|
+
add_git_tag(tag: git_tag_name) # Add git tag
|
154
|
+
push_to_git_remote # Push `Changelog.yml` file and git-tag to remote
|
155
|
+
|
156
|
+
slack(message: "Hi team, we have a new beta build #{git_tag_name}, which includes the following: #{changelog}") # share on Slack
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
160
|
+
## Issues and Feedback
|
161
|
+
|
162
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
163
|
+
|
164
|
+
## Troubleshooting
|
165
|
+
|
166
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
167
|
+
|
168
|
+
## Using _fastlane_ Plugins
|
169
|
+
|
170
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
171
|
+
|
172
|
+
## About _fastlane_
|
173
|
+
|
174
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/unreleased_changelog/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module UnreleasedChangelog
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::UnreleasedChangelog.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/unreleased_changelog_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class AddUnreleasedChangelogAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
changelog_file_name = "#{params[:file_name]}.yml"
|
11
|
+
UI.important("Adding unreleased changelog: \"#{changelog_file_name}\" 🚥")
|
12
|
+
|
13
|
+
# finding changelog file path
|
14
|
+
changelog_file_path = Helper::UnreleasedChangelogHelper.changelog_file_path(changelog_file_name)
|
15
|
+
unreleased_section_name = Helper::UnreleasedChangelogHelper.unreleased_section_name
|
16
|
+
|
17
|
+
# opening the changelog file
|
18
|
+
changelog = YAML.load_file(changelog_file_path)
|
19
|
+
|
20
|
+
# finding the unreleased changelog
|
21
|
+
unreleased_changelog = changelog[unreleased_section_name] || {}
|
22
|
+
|
23
|
+
# adding a new entry in changelog file
|
24
|
+
(unreleased_changelog[params[:type]] ||= []) << params[:entry]
|
25
|
+
|
26
|
+
# saving the changelog file
|
27
|
+
changelog[unreleased_section_name] = unreleased_changelog
|
28
|
+
File.open(changelog_file_path,"w") do |file|
|
29
|
+
file.write changelog.to_yaml
|
30
|
+
end
|
31
|
+
|
32
|
+
UI.success("Successfully added a new entry in unreleased changelog. 📝")
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.description
|
36
|
+
"Add a new entry in unreleased changelog"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.available_options
|
40
|
+
[
|
41
|
+
FastlaneCore::ConfigItem.new(key: :entry,
|
42
|
+
env_name: "FL_ADD_UNRELEASED_CHANGELOG_ENTRY",
|
43
|
+
description: "The changelog entry in string format",
|
44
|
+
is_string: true),
|
45
|
+
FastlaneCore::ConfigItem.new(key: :type,
|
46
|
+
env_name: "FL_ADD_UNRELEASED_CHANGELOG_TYPE",
|
47
|
+
description: "The type of changelog i.e Added, Fixed, Security etc (default: Added) ",
|
48
|
+
default_value: "Added"),
|
49
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
50
|
+
env_name: "FL_ADD_UNRELEASED_CHANGELOG_FILE_NAME",
|
51
|
+
description: "The YML file name to your release changelog, (default: 'changelog')",
|
52
|
+
is_string: true,
|
53
|
+
default_value: "changelog")
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.authors
|
58
|
+
["crazymanish"]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.example_code
|
62
|
+
[
|
63
|
+
'add_unreleased_changelog(entry: "Some changelog entry")',
|
64
|
+
'add_unreleased_changelog(entry: "Some changelog entry", type: "Fixed")',
|
65
|
+
'add_unreleased_changelog(entry: "Some changelog entry", type: "Fixed", file_name: "changelog_file_name")'
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.is_supported?(platform)
|
70
|
+
true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/unreleased_changelog_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class DeleteUnreleasedChangelogAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
changelog_entry = params[:entry]
|
11
|
+
changelog_file_name = "#{params[:file_name]}.yml"
|
12
|
+
UI.important("Deleting \"#{changelog_entry}\" from the unreleased changelog 🚥")
|
13
|
+
|
14
|
+
# finding changelog file path
|
15
|
+
changelog_file_path = Helper::UnreleasedChangelogHelper.changelog_file_path(changelog_file_name)
|
16
|
+
unreleased_section_name = Helper::UnreleasedChangelogHelper.unreleased_section_name
|
17
|
+
|
18
|
+
# opening the changelog file
|
19
|
+
changelog = YAML.load_file(changelog_file_path)
|
20
|
+
|
21
|
+
# finding the unreleased changelog
|
22
|
+
unreleased_changelog = changelog[unreleased_section_name]
|
23
|
+
|
24
|
+
# deleting entry from unreleased changelog
|
25
|
+
changelog_types = Helper::UnreleasedChangelogHelper.changelog_types
|
26
|
+
changelog_types.each do |changelog_type|
|
27
|
+
delete_changelog(changelog_entry, changelog_type, unreleased_changelog)
|
28
|
+
end
|
29
|
+
|
30
|
+
# saving the changelog file
|
31
|
+
File.open(changelog_file_path,"w") do |file|
|
32
|
+
file.write changelog.to_yaml
|
33
|
+
end
|
34
|
+
|
35
|
+
UI.success("Successfully deleted \"#{changelog_entry}\" from the unreleased changelog. 🔥")
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.delete_changelog(entry, type, unreleased_changelog)
|
39
|
+
if unreleased_changelog[type]
|
40
|
+
unreleased_changelog[type] = unreleased_changelog[type].reject do |changelog|
|
41
|
+
changelog.include?(entry)
|
42
|
+
end
|
43
|
+
|
44
|
+
unreleased_changelog[type] = nil if unreleased_changelog[type].to_a.empty?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.description
|
49
|
+
"Delete changelog entry from unreleased changelog"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.available_options
|
53
|
+
[
|
54
|
+
FastlaneCore::ConfigItem.new(key: :entry,
|
55
|
+
env_name: "FL_DELETE_UNRELEASED_CHANGELOG_ENTRY",
|
56
|
+
description: "The changelog entry in string format",
|
57
|
+
is_string: true),
|
58
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
59
|
+
env_name: "FL_DELETE_UNRELEASED_CHANGELOG_FILE_NAME",
|
60
|
+
description: "The YML file name to your release changelog, (default: 'changelog')",
|
61
|
+
is_string: true,
|
62
|
+
default_value: "changelog")
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.authors
|
67
|
+
["crazymanish"]
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.example_code
|
71
|
+
[
|
72
|
+
'delete_unreleased_changelog(entry: "Some changelog entry")',
|
73
|
+
'delete_unreleased_changelog(entry: "Some changelog entry", file_name: "changelog_file_name")'
|
74
|
+
]
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.is_supported?(platform)
|
78
|
+
true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/unreleased_changelog_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class EnsureUnreleasedChangelogAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
# reading unreleased changelog
|
9
|
+
unreleased_changelog = GetUnreleasedChangelogAction.run(file_name: params[:file_name])
|
10
|
+
|
11
|
+
# checking unreleased changelog
|
12
|
+
is_empty_unreleased_changelog = true
|
13
|
+
changelog_types = Helper::UnreleasedChangelogHelper.changelog_types
|
14
|
+
changelog_types.each do |changelog_type|
|
15
|
+
is_empty_unreleased_changelog = false unless unreleased_changelog[changelog_type].nil?
|
16
|
+
|
17
|
+
# printing unreleased changelog, if needed.
|
18
|
+
if params[:show_diff]
|
19
|
+
self.print_unreleased(unreleased_changelog, changelog_type)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
UI.user_error!("No unreleased changelog found 🔥🛑") if is_empty_unreleased_changelog
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.print_unreleased(changelog, type)
|
27
|
+
require 'terminal-table'
|
28
|
+
|
29
|
+
changelog_type = changelog[type]
|
30
|
+
|
31
|
+
if changelog_type.nil?
|
32
|
+
UI.important("Unreleased \"#{type}\" changelog does not exist! ⁉️")
|
33
|
+
else
|
34
|
+
UI.success("Unreleased \"#{type}\" changelog found! 🍻")
|
35
|
+
|
36
|
+
formatted_changelog = changelog_type.map {|changelog| [changelog]}
|
37
|
+
table = Terminal::Table.new(title: "Unreleased \"#{type}\" changelog", rows: formatted_changelog)
|
38
|
+
puts table
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.description
|
43
|
+
"Raises an exception if there are no unreleased release notes changelog"
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.available_options
|
47
|
+
[
|
48
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
49
|
+
env_name: "FL_ENSURE_UNRELEASED_CHANGELOG_FILE_NAME",
|
50
|
+
description: "The YML file name to your release changelog, (default: 'changelog')",
|
51
|
+
is_string: true,
|
52
|
+
default_value: "changelog"),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :show_diff,
|
54
|
+
env_name: "FL_ENSURE_UNRELEASED_CHANGELOG_SHOW_DIFF",
|
55
|
+
description: "The flag whether to show the unreleased changelog if found",
|
56
|
+
optional: true,
|
57
|
+
default_value: true,
|
58
|
+
is_string: false)
|
59
|
+
]
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.authors
|
63
|
+
["crazymanish"]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.example_code
|
67
|
+
[
|
68
|
+
'ensure_unreleased_changelog',
|
69
|
+
'ensure_unreleased_changelog(file_name: "changelog_file_name")'
|
70
|
+
]
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.is_supported?(platform)
|
74
|
+
true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/unreleased_changelog_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
GET_UNRELEASED_CHANGELOG_INFO = :GET_UNRELEASED_CHANGELOG_INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
class GetUnreleasedChangelogAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
require 'yaml'
|
13
|
+
|
14
|
+
changelog_file_name = "#{params[:file_name]}.yml"
|
15
|
+
UI.important("Reading unreleased changelog: \"#{changelog_file_name}\" 🚥")
|
16
|
+
|
17
|
+
# finding changelog file path
|
18
|
+
changelog_file_path = Helper::UnreleasedChangelogHelper.changelog_file_path(changelog_file_name)
|
19
|
+
unreleased_section_name = Helper::UnreleasedChangelogHelper.unreleased_section_name
|
20
|
+
|
21
|
+
# opening the changelog file
|
22
|
+
changelog = YAML.load_file(changelog_file_path)
|
23
|
+
|
24
|
+
# finding the unreleased changelog
|
25
|
+
unreleased_changelog = changelog[unreleased_section_name]
|
26
|
+
|
27
|
+
Actions.lane_context[SharedValues::GET_UNRELEASED_CHANGELOG_INFO] = unreleased_changelog
|
28
|
+
return unreleased_changelog
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
"Get the unreleased changelog"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
38
|
+
env_name: "FL_GET_UNRELEASED_CHANGELOG_FILE_NAME",
|
39
|
+
description: "The YML file name to your release changelog, (default: 'changelog')",
|
40
|
+
is_string: true,
|
41
|
+
default_value: "changelog")
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.authors
|
46
|
+
["crazymanish"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.example_code
|
50
|
+
[
|
51
|
+
'get_unreleased_changelog',
|
52
|
+
'get_unreleased_changelog(file_name: "changelog_file_name")'
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.is_supported?(platform)
|
57
|
+
true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/unreleased_changelog_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class StampUnreleasedChangelogAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
changelog_file_name = "#{params[:file_name]}.yml"
|
11
|
+
UI.important("Stamping unreleased changelog: \"#{changelog_file_name}\" 🚥")
|
12
|
+
|
13
|
+
# finding changelog file path
|
14
|
+
changelog_file_path = Helper::UnreleasedChangelogHelper.changelog_file_path(changelog_file_name)
|
15
|
+
unreleased_section_name = Helper::UnreleasedChangelogHelper.unreleased_section_name
|
16
|
+
|
17
|
+
# update unreleased release-notes changelog with release_name
|
18
|
+
changelog = YAML.load_file(changelog_file_path)
|
19
|
+
stamping_changelog = {params[:tag]=> changelog[unreleased_section_name]}
|
20
|
+
changelog.delete(unreleased_section_name)
|
21
|
+
|
22
|
+
# create new unreleased release-notes changelog section for upcoming release
|
23
|
+
upcoming_release_changelog = {unreleased_section_name=> nil}
|
24
|
+
upcoming_release_changelog.merge!(stamping_changelog)
|
25
|
+
upcoming_release_changelog.merge!(changelog)
|
26
|
+
|
27
|
+
# save release notes changelog file
|
28
|
+
File.open(changelog_file_path,"w") do |file|
|
29
|
+
file.write upcoming_release_changelog.to_yaml
|
30
|
+
end
|
31
|
+
|
32
|
+
UI.success("Successfully stamp the unreleased changelog with \"#{params[:tag]}\" tag. 🕹")
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.description
|
36
|
+
"Stamp unreleased changelog"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.available_options
|
40
|
+
[
|
41
|
+
FastlaneCore::ConfigItem.new(key: :tag,
|
42
|
+
env_name: "FL_STAMP_UNRELEASED_CHANGELOG_TAG_NAME",
|
43
|
+
description: "The tag, (usually a git-tag name) for Unreleased section",
|
44
|
+
verify_block: proc do |value|
|
45
|
+
UI.user_error!("No Unreleased tag given inside input params") unless (value and not value.empty?)
|
46
|
+
end),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
48
|
+
env_name: "FL_STAMP_UNRELEASED_CHANGELOG_FILE_NAME",
|
49
|
+
description: "The YML file name to your release changelog, (default: 'changelog')",
|
50
|
+
is_string: true,
|
51
|
+
default_value: "changelog")
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.authors
|
56
|
+
["crazymanish"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.example_code
|
60
|
+
[
|
61
|
+
'stamp_unreleased_changelog(tag: "v1.0.0")',
|
62
|
+
'stamp_unreleased_changelog(tag: "v1.0.0", file_name: "changelog_file_name")'
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.is_supported?(platform)
|
67
|
+
true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class UnreleasedChangelogHelper
|
8
|
+
|
9
|
+
def self.unreleased_section_name
|
10
|
+
return 'Unreleased'
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.changelog_types
|
14
|
+
return ['Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security']
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.changelog_file_path(changelog_file_name)
|
18
|
+
# finding the git repo root path
|
19
|
+
repo_path = Fastlane::Actions::sh("git rev-parse --show-toplevel").strip
|
20
|
+
|
21
|
+
# finding the release-notes changelog file path
|
22
|
+
changelog_file_paths = Dir[File.expand_path(File.join(repo_path, "**/#{changelog_file_name}"))]
|
23
|
+
|
24
|
+
# no changelog found: error
|
25
|
+
if changelog_file_paths.count == 0
|
26
|
+
UI.user_error!("Could not find a #{changelog_file_name} 🛑")
|
27
|
+
end
|
28
|
+
|
29
|
+
# too many changelog found: error
|
30
|
+
if changelog_file_paths.count > 1
|
31
|
+
UI.message("Found #{changelog_file_name} files at path: #{changelog_file_paths} 🙈")
|
32
|
+
UI.user_error!("Found multiple #{changelog_file_name} 🛑")
|
33
|
+
end
|
34
|
+
|
35
|
+
UI.success("Found #{changelog_file_name} file at path: #{changelog_file_paths.first} 💪🏻")
|
36
|
+
|
37
|
+
return changelog_file_paths.first
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-unreleased_changelog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Manish Rathi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.146.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.146.1
|
139
|
+
description:
|
140
|
+
email: manishrathi19902013@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/unreleased_changelog.rb
|
148
|
+
- lib/fastlane/plugin/unreleased_changelog/actions/add_unreleased_changelog.rb
|
149
|
+
- lib/fastlane/plugin/unreleased_changelog/actions/delete_unreleased_changelog.rb
|
150
|
+
- lib/fastlane/plugin/unreleased_changelog/actions/ensure_unreleased_changelog.rb
|
151
|
+
- lib/fastlane/plugin/unreleased_changelog/actions/get_unreleased_changelog.rb
|
152
|
+
- lib/fastlane/plugin/unreleased_changelog/actions/stamp_unreleased_changelog.rb
|
153
|
+
- lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb
|
154
|
+
- lib/fastlane/plugin/unreleased_changelog/version.rb
|
155
|
+
homepage: https://github.com/crazymanish/fastlane-plugin-unreleased_changelog
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
metadata: {}
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
requirements: []
|
174
|
+
rubygems_version: 3.0.3
|
175
|
+
signing_key:
|
176
|
+
specification_version: 4
|
177
|
+
summary: "A fastlane plugin to manage unreleased changelog using a YAML file. \U0001F680"
|
178
|
+
test_files: []
|