From cc14f1f5676585fac52e1db4166bbe286ea693ef Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Mon, 27 Jun 2022 20:41:00 +0300 Subject: [PATCH] Towncrier fixes (#97) --- .gitignore | 2 ++ changelog.d/96.misc | 1 + changelog.d/_template.md.jinja | 8 ++------ fastlane/Fastfile | 7 +------ fastlane/changelog.rb | 21 +-------------------- 5 files changed, 7 insertions(+), 32 deletions(-) create mode 100644 changelog.d/96.misc diff --git a/.gitignore b/.gitignore index b6db53bac..475433051 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots/**/*.png fastlane/test_output +towncrier.toml.tmp +version_changes.md build Tools/Scripts/element-android diff --git a/changelog.d/96.misc b/changelog.d/96.misc new file mode 100644 index 000000000..25ed8cfec --- /dev/null +++ b/changelog.d/96.misc @@ -0,0 +1 @@ +Fix project urls in Towncrier configuration. diff --git a/changelog.d/_template.md.jinja b/changelog.d/_template.md.jinja index a0b2dd9ee..7b2ae45fa 100644 --- a/changelog.d/_template.md.jinja +++ b/changelog.d/_template.md.jinja @@ -1,7 +1,6 @@ {# iOS Repositories #} -{%- set gh_sdk = "https://github.com/matrix-org/matrix-ios-sdk" -%} -{%- set gh_kit = "https://github.com/matrix-org/matrix-ios-kit" -%} -{%- set gh_element = "https://github.com/vector-im/element-ios" -%} +{%- set gh_sdk = "https://github.com/matrix-org/matrix-rust-sdk" -%} +{%- set gh_element = "https://github.com/vector-im/element-x-ios" -%} ## {{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }}) {% for section, _ in sections.items() %} @@ -18,9 +17,6 @@ {%- if value.startswith("sdk-") %} {%- set gh_issue = value.replace("sdk-", "") -%} {{- links.append( "[#%s](%s/issues/%s)" | format(gh_issue, gh_sdk, gh_issue) ) | default("", True) -}} - {%- elif value.startswith("kit-") %} - {%- set gh_issue = value.replace("kit-", "") -%} - {{- links.append( "[#%s](%s/issues/%s)" | format(gh_issue, gh_kit, gh_issue) ) | default("", True) -}} {%- elif value.startswith("#") %} {%- set gh_issue = value.replace("#", "") -%} {{- links.append( "[#%s](%s/issues/%s)" | format(gh_issue, gh_element, gh_issue) ) | default("", True) -}} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ea2b4a59b..865697132 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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 diff --git a/fastlane/changelog.rb b/fastlane/changelog.rb index ff19b43ab..404c7131a 100644 --- a/fastlane/changelog.rb +++ b/fastlane/changelog.rb @@ -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