From 9502f05de6c52b464f539b03a2dc70b6cd4788be Mon Sep 17 00:00:00 2001 From: otegami Date: Wed, 4 Dec 2024 11:29:39 +0900 Subject: [PATCH 1/6] release blog: generate release post with contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub: GH-83 In this PR, we implement a Rake task for generating release announce posts in blog. Generate release announce posts ```console $ rake release:blog:generate $ tree . | grep 2024-11-15-groonga-14.1.0.md │   └── 2024-11-15-groonga-14.1.0.md │   │   └── 2024-11-15-groonga-14.1.0.md ``` ```console $ cat en/_posts/2024-11-15-groonga-14.1.0.md --- layout: post.en title: Groonga 14.1.0 has been released description: Groonga 14.1.0 has been released! --- Groonga 14.1.0 has been released! For installation instructions on your environments, please see the [Installation Guide](/docs/install.html). For the information on the changes, please see the [Release Note](/docs/news/14.html#release-14-1-0-2024-12-04). $ cat ja/_posts/2024-11-15-groonga-14.1.0.md cat ja/_posts/2024-11-05-groonga-14.1.0.md --- layout: post.ja title: Groonga 14.1.0リリース description: Groonga 14.1.0をリリースしました! --- Groonga 14.1.0をリリースしました! それぞれの環境毎のインストール方法は、[インストール](/ja/docs/install.html)をご確認ください。 主な変更点のついては、[リリースノート](/ja/docs/news/14.html#release-14-1-0)をご確認ください。 ``` --- release_task.rb | 52 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/release_task.rb b/release_task.rb index f015cbb647..9140f9fa21 100644 --- a/release_task.rb +++ b/release_task.rb @@ -63,10 +63,56 @@ def post_filename "#{@release_date.strftime("%F")}-#{@product_id}-#{@version}.md" end + def release_note_url + major_version = @version.split(".")[0]; + "/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}" + end + + def post_ja_content + <<-CONTENT +--- +layout: post.ja +title: #{@product} #{@version}リリース +description: #{@product} #{@version}をリリースしました! +--- + +## #{@product} #{@version}リリース + +#{@product} #{@version}をリリースしました! + +それぞれの環境毎のインストール方法は、[インストール](/ja/docs/install.html)をご確認ください。 + +主な変更点のついては、[リリースノート](/ja#{release_note_url})をご確認ください。 + CONTENT + end + + def post_en_content + <<-CONTENT +--- +layout: post.en +title: #{@product} #{@version} has been released +description: #{@product} #{@version} has been released! +--- + +## #{@product} #{@version} has been released + +#{@product} #{@version} has been released! + +For installation instructions on your environments, please see the [Installation Guide](/docs/install.html). + +For the information on the changes, please see the [Release Note](#{release_note_url}). + CONTENT + end + def post_content(locale) - # TODO: We will write blog post contents here. - # After writing contents, we will remove this TODO comment. - "#{locale}, #{@product}, #{@version}" + case locale + when "ja" + post_ja_content + when "en" + post_en_content + else + raise "#{locale} isn't supported for release announce posts in blog." + end end def generate_blog_posts From afe81022a14f3f698e91c19e3ea8441690e32bb0 Mon Sep 17 00:00:00 2001 From: otegami Date: Thu, 5 Dec 2024 09:00:21 +0900 Subject: [PATCH 2/6] Extract product_install_url because install_url might be different depending on products --- release_task.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/release_task.rb b/release_task.rb index 9140f9fa21..6420c0b842 100644 --- a/release_task.rb +++ b/release_task.rb @@ -63,6 +63,10 @@ def post_filename "#{@release_date.strftime("%F")}-#{@product_id}-#{@version}.md" end + def product_install_url + "/docs/install.html" + end + def release_note_url major_version = @version.split(".")[0]; "/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}" @@ -80,7 +84,7 @@ def post_ja_content #{@product} #{@version}をリリースしました! -それぞれの環境毎のインストール方法は、[インストール](/ja/docs/install.html)をご確認ください。 +それぞれの環境毎のインストール方法は、[インストール](/ja#{product_install_url})をご確認ください。 主な変更点のついては、[リリースノート](/ja#{release_note_url})をご確認ください。 CONTENT @@ -98,7 +102,7 @@ def post_en_content #{@product} #{@version} has been released! -For installation instructions on your environments, please see the [Installation Guide](/docs/install.html). +For installation instructions on your environments, please see the [Installation Guide](#{product_install_url}). For the information on the changes, please see the [Release Note](#{release_note_url}). CONTENT From 12bdd728e3fe4ddaa909bcf0160076b2fe092c6b Mon Sep 17 00:00:00 2001 From: otegami Date: Thu, 5 Dec 2024 09:02:22 +0900 Subject: [PATCH 3/6] Add the product prefix because it might be different each products --- release_task.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release_task.rb b/release_task.rb index 6420c0b842..c4e8eb7ed4 100644 --- a/release_task.rb +++ b/release_task.rb @@ -67,7 +67,7 @@ def product_install_url "/docs/install.html" end - def release_note_url + def product_release_note_url major_version = @version.split(".")[0]; "/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}" end @@ -86,7 +86,7 @@ def post_ja_content それぞれの環境毎のインストール方法は、[インストール](/ja#{product_install_url})をご確認ください。 -主な変更点のついては、[リリースノート](/ja#{release_note_url})をご確認ください。 +主な変更点のついては、[リリースノート](/ja#{product_release_note_url})をご確認ください。 CONTENT end @@ -104,7 +104,7 @@ def post_en_content For installation instructions on your environments, please see the [Installation Guide](#{product_install_url}). -For the information on the changes, please see the [Release Note](#{release_note_url}). +For the information on the changes, please see the [Release Note](#{product_release_note_url}). CONTENT end From b2d3c120e23870b839ddd2d0d70647c0bcc350cf Mon Sep 17 00:00:00 2001 From: otegami Date: Thu, 5 Dec 2024 09:45:30 +0900 Subject: [PATCH 4/6] Remove an unnecessary semicolon --- release_task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_task.rb b/release_task.rb index c4e8eb7ed4..ea53d3df5a 100644 --- a/release_task.rb +++ b/release_task.rb @@ -68,7 +68,7 @@ def product_install_url end def product_release_note_url - major_version = @version.split(".")[0]; + major_version = @version.split(".")[0] "/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}" end From 007789ddb9ab6a53ba09b57313d223c073413e61 Mon Sep 17 00:00:00 2001 From: otegami Date: Thu, 5 Dec 2024 09:47:52 +0900 Subject: [PATCH 5/6] Fix the release post contents --- release_task.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_task.rb b/release_task.rb index ea53d3df5a..4f732682b2 100644 --- a/release_task.rb +++ b/release_task.rb @@ -86,7 +86,7 @@ def post_ja_content それぞれの環境毎のインストール方法は、[インストール](/ja#{product_install_url})をご確認ください。 -主な変更点のついては、[リリースノート](/ja#{product_release_note_url})をご確認ください。 +主な変更点は、[リリースノート](/ja#{product_release_note_url})をご確認ください。 CONTENT end @@ -104,7 +104,7 @@ def post_en_content For installation instructions on your environments, please see the [Installation Guide](#{product_install_url}). -For the information on the changes, please see the [Release Note](#{product_release_note_url}). +For the information on the changes in this release, please see the [Release Note](#{product_release_note_url}). CONTENT end From ed63a9e13a23e181937f56026166684ddc5552fe Mon Sep 17 00:00:00 2001 From: otegami Date: Thu, 5 Dec 2024 09:51:13 +0900 Subject: [PATCH 6/6] Simplify the calling methods allows us to understand the flow easily. --- release_task.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/release_task.rb b/release_task.rb index 4f732682b2..9544b8ed3a 100644 --- a/release_task.rb +++ b/release_task.rb @@ -72,7 +72,7 @@ def product_release_note_url "/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}" end - def post_ja_content + def post_content_ja <<-CONTENT --- layout: post.ja @@ -90,7 +90,7 @@ def post_ja_content CONTENT end - def post_en_content + def post_content_en <<-CONTENT --- layout: post.en @@ -108,21 +108,10 @@ def post_en_content CONTENT end - def post_content(locale) - case locale - when "ja" - post_ja_content - when "en" - post_en_content - else - raise "#{locale} isn't supported for release announce posts in blog." - end - end - def generate_blog_posts ["ja", "en"].each do |locale| File.open("#{@jekyll_path}/#{locale}/_posts/#{post_filename}", "w") do |post| - post.write(post_content(locale)) + post.write(__send__("post_content_#{locale}")) end end end