Git hook triggered via local commit or Gitea's one. It runs Hugo against its dedicated repository with Markdown files and related assets.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
670 B

2 years ago
package main
import (
func writeLogToFile(logLines, path string) {
lastPublishCommitLog, err := os.Create(filepath.Join(path, "last-commit-log.txt"))
defer lastPublishCommitLog.Close()
fmt.Fprintln(lastPublishCommitLog, logLines)
func writeLastCommitLog(logLines string, isBare bool, hugo *Hugo, hook *Hook) {
if isBare {
if hook.Publish {
writeLogToFile(logLines, filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName))
} else {
writeLogToFile(logLines, filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName, "_preview"))
} else {
writeLogToFile(logLines, filepath.Join(hugo.DestinationDir))