chore: simplify workflows and unify tool logging and mail presentation
Release / Validate Templates (push) Successful in 2m55s
Release / Package & Release (push) Skipped
Release / Remind to Update Release Documentation (push) Skipped

This commit is contained in:
KenanZhu committed 2026-10-10 14:54:40 +08:00
1 parent f4d96de79e
commit c93f2bf8b2
40 files changed
+523 -1515

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
package cli
import (
"fmt"
"gitea-mail-templates/tools/builder"
"gitea-mail-templates/tools/logging"
"gitea-mail-templates/tools/upstream"
"github.com/urfave/cli/v2"
"path/filepath"
@@ -26,7 +26,7 @@ func BuildCommand() *cli.Command {
if err := builder.Write(output, s, packages); err != nil {
return err
}
fmt.Printf("[PASS] Built %d themes for %s at %s\n", len(packages), s.Lock.Tag, output)
logging.Info("Builder", "Built %d themes for %s at %s", len(packages), s.Lock.Tag, output)
return nil
}}
}
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"gitea-mail-templates/tools/builder"
"gitea-mail-templates/tools/logging"
"github.com/urfave/cli/v2"
"os"
"path/filepath"
@@ -36,7 +37,7 @@ func runCreate(c *cli.Context) error {
if err := os.WriteFile(filepath.Join(dir, "theme.css"), []byte(css), 0644); err != nil {
return err
}
fmt.Printf("[PASS] Created framework theme %s\n", name)
logging.Info("CLI", "Created framework theme %s", name)
}
return nil
}
+3 -2
View File
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
"gitea-mail-templates/tools/logging"
"os"
"path/filepath"
@@ -44,7 +45,7 @@ func runDelete(c *cli.Context) error {
}
if _, err := os.Stat(styleDir); os.IsNotExist(err) {
fmt.Printf("\033[33m[W]\033[0m [CLI] '%s' does not exist, skipped\n", styleName)
logging.Warn("CLI", "'%s' does not exist, skipped", styleName)
continue
}
if _, err := builder.LoadTheme(styleDir); err != nil {
@@ -54,7 +55,7 @@ func runDelete(c *cli.Context) error {
if err := os.RemoveAll(styleDir); err != nil {
return fmt.Errorf("cannot delete %s: %w", styleDir, err)
}
fmt.Printf("\033[32m[I]\033[0m [CLI] Deleted style '%s'\n", styleName)
logging.Info("CLI", "Deleted style '%s'", styleName)
}
return nil
+2 -1
View File
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
"gitea-mail-templates/tools/logging"
"os"
"os/signal"
"path/filepath"
@@ -69,7 +70,7 @@ func runDev(c *cli.Context) error {
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigCh
fmt.Println("\n\033[32m[I]\033[0m [Server] Shutting down")
logging.Info("Server", "Shutting down")
os.Exit(0)
}()
+2 -1
View File
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
"gitea-mail-templates/tools/logging"
"path/filepath"
"github.com/urfave/cli/v2"
@@ -77,7 +78,7 @@ func runPreview(c *cli.Context) error {
preview.PrintDetailedSummary(result, folder, cfg)
fmt.Printf("\033[32m[I]\033[0m [Preview] Wrote %d themes x %d templates to %s\n",
logging.Info("Preview", "Wrote %d themes x %d templates to %s",
len(result.Themes), len(cfg.Templates), outputPath)
return nil
+3 -3
View File
@@ -1,7 +1,7 @@
package cli
import (
"fmt"
"gitea-mail-templates/tools/logging"
"gitea-mail-templates/tools/upstream"
"github.com/urfave/cli/v2"
)
@@ -19,10 +19,10 @@ func UpstreamCommand() *cli.Command {
if err != nil {
return err
}
fmt.Printf("[PASS] %s: %d mail files, %d languages\n", s.Lock.Tag, len(s.Templates), len(s.Locales))
logging.Info("Upstream", "%s: %d mail files, %d languages", s.Lock.Tag, len(s.Templates), len(s.Locales))
for _, lang := range s.Languages() {
if keys := missing[lang]; len(keys) > 0 {
fmt.Printf("[FALLBACK] %s -> en-US: %v\n", lang, keys)
logging.Warn("Locale", "%s -> en-US: %v", lang, keys)
}
}
return nil