about summary refs log tree commit diff
path: root/release-email.scm
diff options
context:
space:
mode:
Diffstat (limited to 'release-email.scm')
-rwxr-xr-xrelease-email.scm92
1 files changed, 92 insertions, 0 deletions
diff --git a/release-email.scm b/release-email.scm
new file mode 100755
index 0000000..98748c9
--- /dev/null
+++ b/release-email.scm
@@ -0,0 +1,92 @@
+#! /usr/bin/env guile
+!#
+
+;;; guile-xapian --- Guile bindings for Xapian
+;;; Copyright © 2026 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of guile-xapian.
+;;;
+;;; guile-xapian is free software: you can redistribute it and/or
+;;; modify it under the terms of the GNU General Public License as
+;;; published by the Free Software Foundation, either version 2 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; guile-xapian 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
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with guile-xapian.  If not, see
+;;; <https://www.gnu.org/licenses/>.
+
+(use-modules (rnrs io ports)
+             (srfi srfi-1)
+             (srfi srfi-26)
+             (srfi srfi-28)
+             (srfi srfi-171)
+             (ice-9 match)
+             (ice-9 popen)
+             (web uri))
+
+(define (call-with-input-pipe command proc)
+  "Call @var{proc} with input pipe to @var{command}. @var{command} is a
+list of program arguments."
+  (match command
+    ((prog args ...)
+     (let ((port #f))
+       (dynamic-wind
+         (lambda ()
+           (set! port (apply open-pipe* OPEN_READ prog args)))
+         (cut proc port)
+         (lambda ()
+           (unless (zero? (close-pipe port))
+             (error "Command invocation failed" command))))))))
+
+(let* ((version
+        (match (call-with-input-pipe (list "git" "tag")
+                 (cut port-transduce
+                      (tmap identity)
+                      rcons
+                      get-line
+                      <>))
+          (()
+           (error "No git tags found"))
+          (tags
+           (string-trim (last tags) #\v))))
+       (body (format "
+Hi all,
+
+guile-xapian ~a has been released.
+
+guile-xapian provides Guile bindings for Xapian[1], a search engine
+library used in popular applications such as the notmuch email
+system. Xapian is a highly adaptable toolkit which allows developers to
+easily add advanced indexing and search facilities to their own
+applications. It has built-in support for several families of weighting
+models and also supports a rich set of boolean query operators.
+
+[1]: https://xapian.org/
+
+Please find links to the project home page and tarball below. The
+changes in this release are described in the NEWS file in the tarball.
+
+https://guile-xapian.systemreboot.net/
+https://guile-xapian.systemreboot.net/releases/guile-xapian-~a.tar.lz
+https://guile-xapian.systemreboot.net/releases/guile-xapian-~a.tar.lz.asc
+
+Cheers!
+"
+                     version version version)))
+  (system* "xdg-open"
+           (string-append "mailto:guile-xapian@systemreboot.net?"
+                          (string-join
+                           (map (match-lambda
+                                  ((key . value)
+                                   (string-append key "=" (uri-encode value))))
+                                `(("to" . "guile-user@gnu.org")
+                                  ("subject" . ,(format "guile-xapian ~a released"
+                                                        version))
+                                  ("body" . ,body)))
+                           "&"))))
+