mirror of
https://github.com/MizuchiLabs/mantrae.git
synced 2025-12-16 20:05:17 -06:00
test cleanup
This commit is contained in:
8
.github/workflows/cleanup.yml
vendored
Normal file
8
.github/workflows/cleanup.yml
vendored
Normal 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 }}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
8
agent/client/version.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package client
|
||||
|
||||
var (
|
||||
Version = "unknown"
|
||||
BuildDate string
|
||||
Commit string
|
||||
Branch string
|
||||
)
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user