32 lines
793 B
Go
32 lines
793 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// GitCaddy Runner is a CI/CD runner for Gitea Actions.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"git.marketally.com/gitcaddy/gitcaddy-runner/internal/app/cmd"
|
|
"git.marketally.com/gitcaddy/gitcaddy-runner/internal/pkg/service"
|
|
)
|
|
|
|
func main() {
|
|
// Check if running as Windows service
|
|
if service.IsWindowsService() {
|
|
// Run as Windows service with proper SCM handling
|
|
_ = service.RunAsService(service.GetServiceName(), func(ctx context.Context) {
|
|
cmd.Execute(ctx)
|
|
})
|
|
return
|
|
}
|
|
|
|
// Normal interactive mode with signal handling
|
|
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
|
defer stop()
|
|
// run the command
|
|
cmd.Execute(ctx)
|
|
}
|