Plugins API for https://github.com/gohugoio/hugoreleaser
A plugin is a Go Module with a main func, e.g., using the API provided by the archiveplugin package:
func main() {
server, err := server.New(
func(d server.Dispatcher, req archiveplugin.Request) archiveplugin.Response {
d.Infof("Creating archive %s", req.OutFilename)
if err := req.Init(); err != nil {
// ... handle error.
}
if err := createArchive(req); err != nil {
// ... handle error.
}
// Empty response is a success.
return archiveplugin.Response{}
},
)
if err != nil {
log.Fatalf("Failed to create server: %s", err)
}
if err := server.Start(); err != nil {
log.Fatalf("Failed to start server: %s", err)
}
_ = server.Wait()
}
See the Deb Plugin for a more complete example.