mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Towncrier fixes (#97)
This commit is contained in:
+1
-6
@@ -101,13 +101,8 @@ end
|
||||
|
||||
private_lane :export_version_changes do |options|
|
||||
Dir.chdir("..") do
|
||||
sh("sed -i '.tmp' 's/CHANGES.md/version_changes.md/g' towncrier.toml")
|
||||
Changelog.update_topmost_section(version: options[:version], additional_entries: {})
|
||||
changelog = Changelog.extract_first_section
|
||||
|
||||
# Pushing them directly into the $GITHUB_ENV results in errors
|
||||
# https://trstringer.com/github-actions-multiline-strings/
|
||||
# String substitution and here documents failed too
|
||||
sh("echo '#{changelog}' >> version_changes.md")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+1
-20
@@ -11,9 +11,7 @@ require "date"
|
||||
# Helper methods to handle updates of the Changelog file
|
||||
#
|
||||
module Changelog
|
||||
CHANGES_SEPARATOR_REGEX = /^\#\#\ Changes/.freeze
|
||||
FILE = "CHANGES.md"
|
||||
|
||||
|
||||
# Update the topmost section of the changelog to put version+date in title + add entry for dependency updates
|
||||
#
|
||||
# @param [String] version The version that we are releasing to use in the new title of the first section
|
||||
@@ -43,21 +41,4 @@ module Changelog
|
||||
system("towncrier", "build", "--version", "#{version}", "--yes")
|
||||
end
|
||||
|
||||
# Returns the first section of the Changelog, corresponding to the changes in the latest version
|
||||
#
|
||||
def self.extract_first_section
|
||||
lines = []
|
||||
File.open(FILE, "r") do |file|
|
||||
section_index = 0
|
||||
file.each_line do |line|
|
||||
is_separator_line = (line.chomp =~ CHANGES_SEPARATOR_REGEX)
|
||||
section_index += 1 if is_separator_line
|
||||
break if section_index >= 2
|
||||
|
||||
lines.append(line) if section_index == 1
|
||||
end
|
||||
end
|
||||
lines[0..-2].join # Remove last line (title of section 2)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user