Validate game templates / validate (push) Successful in 9m31s
Adds `gbrgames export`, which builds the games_published payload from every game.yaml, and a CI step that posts it to the panel webhook after validation on main. Unlike the node-agent notify, a failed publish fails the run so stale templates in the panel never go unnoticed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
945 B
Go
38 lines
945 B
Go
// Command gbrgames validates the game templates in this repo and imports them from a panel export.
|
|
//
|
|
// go run ./cmd/gbrgames validate # check every games/<id>/game.yaml (+ test.yaml)
|
|
// go run ./cmd/gbrgames import export.json # write games/<id>/ from GET /api/v1/admin/games
|
|
// go run ./cmd/gbrgames export -out p.json # build the games_published payload CI sends to the panel
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 2 {
|
|
usage()
|
|
}
|
|
var err error
|
|
switch os.Args[1] {
|
|
case "validate":
|
|
err = runValidate(os.Args[2:])
|
|
case "import":
|
|
err = runImport(os.Args[2:])
|
|
case "export":
|
|
err = runExport(os.Args[2:])
|
|
default:
|
|
usage()
|
|
}
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "error:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func usage() {
|
|
fmt.Fprintln(os.Stderr, "usage: gbrgames validate [-games DIR] | import [-games DIR] [-all] EXPORT.json | export [-repo R] [-commit SHA] [-out FILE]")
|
|
os.Exit(2)
|
|
}
|