feat: Add support for service on Windows, Linux, and macOS

Introduce functionality to support the execution of the `act_runner` daemon as a service on various operating systems, including Windows, Linux, and macOS. This enhancement includes the ability to set the working directory using the `--working-directory` flag.

Details:
- The daemon can be installed and enabled with the command `act_runner daemon install`.
- The service can be stopped and uninstalled using `act_runner daemon uninstall`.
- The default working directory is set to the directory containing the `act_runner` executable.
- During the installation process (`act_runner daemon install`), the service checks for the existence of `.runner` and `config.yaml` files in the same directory. If found, these files are loaded into the service.

Note: Prior to running `act_runner daemon install`, ensure registration of `act_runner` with the command `act_runner register` to generate the required `.runner` file.
This commit is contained in:
cachito-worker
2023-11-28 01:33:27 +00:00
parent 91bfe4c186
commit c9ec99c632
5 changed files with 292 additions and 111 deletions

View File

@@ -0,0 +1,19 @@
package helpers
import (
"os"
"github.com/docker/docker/pkg/homedir"
)
func GetCurrentWorkingDirectory() string {
dir, err := os.Getwd()
if err == nil {
return dir
}
return ""
}
func GetHomeDir() string {
return homedir.Get()
}