Skip to content

Commit 0f96d5f

Browse files
committed
Add release target
1 parent 1b5c525 commit 0f96d5f

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Rakefile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,35 @@ task :oobt do
6363
end
6464

6565
desc('release current library')
66-
task :release do
67-
puts("TODO implement release")
66+
task release: [:default] do
67+
# Extract version from meson.build
68+
meson_build = File.read('meson.build')
69+
version = meson_build.match(/version\s*:\s*'([^']+)'/)[1]
70+
tag = "v#{version}"
71+
72+
puts "Releasing #{tag}..."
73+
74+
# Check if tag already exists
75+
if `git tag -l #{tag}`.strip == tag
76+
puts "Tag #{tag} already exists. Skipping git tag."
77+
else
78+
# Ensure working directory is clean
79+
if !`git status --porcelain`.strip.empty?
80+
puts "Working directory is not clean. Please commit or stash changes."
81+
exit 1
82+
end
83+
84+
sh "git tag -a #{tag} -m 'Release #{tag}'"
85+
puts "Created tag #{tag}."
86+
end
87+
88+
# Create distribution package
89+
sh "meson dist -C build"
90+
91+
puts "\nRelease #{tag} completed successfully!"
92+
puts "Next steps:"
93+
puts "1. git push origin #{tag}"
94+
puts "2. Upload build/meson-dist/serpapi-#{version}.tar.xz to GitHub Releases"
6895
end
6996

7097
namespace :install do

0 commit comments

Comments
 (0)