-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathRakefile
70 lines (64 loc) · 2.59 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Copyright (C) 2024 Kodama Takuya <[email protected]>
# Copyright (C) 2024 Horimoto Yasuhiro <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "erb"
require_relative "release_task"
release_task = ReleaseTask.new("Groonga", __dir__)
release_task.define
namespace :pgroonga do
namespace :release do
namespace :blog do
desc "Generate release announce posts"
task :generate do
client = ReleaseTask::GitHubClient.new("pgroonga", "pgroonga")
latest_release = client.latest_release
# "PGroonga 3.2.4: 2024-10-03"
release_name = latest_release["name"]
# "3.2.4"
version = release_name[/\d+\.\d+\.\d+/, 0]
# "2024-10-03"
release_date = Date.parse(release_name[/\d+-\d+-\d+/, 0])
post_md = "#{release_date.strftime("%F")}-pgroonga-#{version}.md"
["ja", "en"].each do |locale|
base_url = "https://pgroonga.github.io"
product_label = "PGroonga"
news_path = "/news/\#version-#{version.gsub(".", "-")}"
template_path = "_templates/#{locale}/_posts/pgroonga-release.md"
case locale
when "ja"
base_url += "/ja"
product_full_label =
"PostgreSQL用ゼロETL高速日本語全文検索モジュール" +
"PGroonga(ぴーじーるんが)"
else
product_full_label =
"PGroonga (zero ETL fast full text search module for PostgreSQL)"
end
template = ERB.new(File.read(template_path))
template.filename = template_path
content = template.result(binding)
path = "#{locale}/_posts/#{post_md}"
File.open(path, "w") do |post|
post.write(content)
end
sh("git", "add", path)
end
sh("git", "commit", "-m", "PGroonga #{version} has been released!!!")
sh("git", "push")
end
end
end
end