Skip to content

Commit

Permalink
release blog: generate release post with contents
Browse files Browse the repository at this point in the history
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)をご確認ください。
```
  • Loading branch information
otegami committed Dec 4, 2024
1 parent da5c96d commit 9502f05
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions release_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9502f05

Please sign in to comment.