mirror of
https://github.com/mariadb-operator/mariadb-operator.git
synced 2026-01-09 17:02:09 +00:00
46 lines
828 B
Go
46 lines
828 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"text/template"
|
|
)
|
|
|
|
func main() {
|
|
version := os.Getenv("VERSION")
|
|
if version == "" {
|
|
log.Println("Environment variable \"VERSION\" is mandatory")
|
|
os.Exit(1)
|
|
}
|
|
|
|
tplBytes, err := os.ReadFile("docs/docker.md.gotmpl")
|
|
if err != nil {
|
|
log.Printf("Error reading docs template: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
tpl := template.New("docker")
|
|
tpl, err = tpl.Parse(string(tplBytes))
|
|
if err != nil {
|
|
log.Printf("Error parsing docs template: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
file, err := os.Create("docs/docker.md")
|
|
if err != nil {
|
|
log.Printf("Error creating docs: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
defer file.Close()
|
|
|
|
err = tpl.Execute(file, struct {
|
|
OperatorVersion string
|
|
}{
|
|
OperatorVersion: version,
|
|
})
|
|
if err != nil {
|
|
log.Printf("Error rendering docs: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|