test cleanup

This commit is contained in:
d34dscene
2024-10-03 18:27:16 +02:00
parent b59d2e0297
commit 727b1e8110
5 changed files with 35 additions and 8 deletions

8
.github/workflows/cleanup.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
jobs:
- name: ghcr.io cleanup action
runs-on: ubuntu-latest
steps:
- uses: dataaxiom/ghcr-cleanup-action@v1
with:
delete-untagged: true
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -12,7 +12,8 @@ before:
- cd web && pnpm install && pnpm run build
builds:
- id: app
- id: server
main: main.go
binary: mantrae
ldflags: -s -w -X github.com/MizuchiLabs/mantrae/pkg/util.Version={{.Version}} -X github.com/MizuchiLabs/mantrae/pkg/util.BuildDate={{.Date}} -X github.com/MizuchiLabs/mantrae/pkg/util.Commit={{.Commit}}
env:
@@ -25,6 +26,16 @@ builds:
- amd64
- arm64
- id: agent
main: ./agent/cmd/main.go
binary: mantrae-agent
ldflags: -s -w -X github.com/MizuchiLabs/mantrae/agent/client.Version={{.Version}} -X github.com/MizuchiLabs/mantrae/agent/client.BuildDate={{.Date}} -X github.com/MizuchiLabs/mantrae/agent/client.Commit={{.Commit}}
goos:
- linux
goarch:
- amd64
- arm64
upx:
- enabled: true

View File

@@ -7,7 +7,7 @@ RUN apk update && apk add --no-cache gcc musl-dev
WORKDIR /app
COPY . .
RUN go build -o mantrae .
RUN go build -ldflags "-s -w" -o mantrae .
# Final Stage
FROM alpine:latest

8
agent/client/version.go Normal file
View File

@@ -0,0 +1,8 @@
package client
var (
Version = "unknown"
BuildDate string
Commit string
Branch string
)

View File

@@ -2,7 +2,7 @@ package main
import (
"flag"
"log"
"fmt"
"log/slog"
"os"
"os/signal"
@@ -25,6 +25,11 @@ func main() {
flag.Parse()
if *version {
fmt.Println(client.Version)
return
}
if *token == "" {
*token = client.LoadToken()
if len(*token) == 0 {
@@ -35,11 +40,6 @@ func main() {
client.SaveToken(*token)
}
if *version {
log.Println("v0.0.1")
return
}
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)