Git hook triggered via local commit or Gitea's one. It runs Hugo against its dedicated repository with Markdown files and related assets.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

26 rader
670 B

package main
import (
"fmt"
"os"
"path/filepath"
)
func writeLogToFile(logLines, path string) {
lastPublishCommitLog, err := os.Create(filepath.Join(path, "last-commit-log.txt"))
check(err)
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))
}
}