Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate release notes #1897

Merged
merged 24 commits into from
Mar 27, 2023
Merged
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/scripts/parse_changelog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/ruby
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require 'date'
require_relative '../../../lib/new_relic/version'

DIVIDER = '---'
SUPPRORT_STATEMENT = "<Callout variant=\"important\">
fallwith marked this conversation as resolved.
Show resolved Hide resolved
fallwith marked this conversation as resolved.
Show resolved Hide resolved
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version at most 90 days old. Read more about [keeping agent up to date](/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/).
fallwith marked this conversation as resolved.
Show resolved Hide resolved

See the New Relic Ruby agent [EOL policy](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-eol-policy/) for information about agent releases and support dates.
</Callout>"

changelog = File.read('CHANGELOG.md')
fallwith marked this conversation as resolved.
Show resolved Hide resolved
latest_entry = changelog.split('##')[1].prepend('##')
titles = latest_entry.scan(/^- \*{2}(.*?)\*{2}$/).flatten # Match strings between sets of '**'
metadata = Hash.new { |h, k| h[k] = [] }

titles.each do |t|
category = t.split(':').first
case category
when 'Feature'
metadata[:features] << t.delete_prefix('Feature: ')
when 'Bugfix'
metadata[:bugs] << t.delete_prefix('Bugfix: ')
when 'Security'
metadata[:security] << t.delete_prefix('Security: ')
end
end

frontmatter = [
DIVIDER,
'subject: Ruby agent',
"date: #{Date.today}",
"version: #{NewRelic::VERSION::STRING}",
"downloadLink: https://rubygems.org/downloads/newrelic_rpm-#{NewRelic::VERSION::STRING}.gem",
"features: #{metadata[:feature]}",
hannahramadan marked this conversation as resolved.
Show resolved Hide resolved
"bugs: #{metadata[:bugs]}",
"security: #{metadata[:security]}",
DIVIDER,
'',
SUPPRORT_STATEMENT,
'',
latest_entry
]

File.write("ruby-agent-#{NewRelic::VERSION::STRING.tr('.', '-')}.mdx", frontmatter.join("\n"))
fallwith marked this conversation as resolved.
Show resolved Hide resolved
fallwith marked this conversation as resolved.
Show resolved Hide resolved