add version information
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# Added by goreleaser init:
|
||||
dist/
|
||||
@@ -0,0 +1,58 @@
|
||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
|
||||
# The lines below are called `modelines`. See `:help modeline`
|
||||
# Feel free to remove those if you don't want/need to use them.
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod tidy
|
||||
# you may remove this if you don't need go generate
|
||||
- go generate ./...
|
||||
|
||||
builds:
|
||||
- main: ./...
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- arm64
|
||||
- amd64
|
||||
- "386"
|
||||
|
||||
archives:
|
||||
- formats: [tar.gz]
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
formats: [zip]
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
|
||||
release:
|
||||
footer: >-
|
||||
|
||||
---
|
||||
|
||||
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
|
||||
@@ -9,8 +9,11 @@ COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
# Copy the source code
|
||||
COPY . .
|
||||
ARG VERSION="dev"
|
||||
ARG COMMIT="unset"
|
||||
ARG DATE="unset"
|
||||
# Build the Go application (strip debug info for smaller size)
|
||||
RUN go build -trimpath -ldflags="-s -w" -o kontor cmd/kontor/main.go
|
||||
RUN go build -trimpath -ldflags="-s -w -X kontor-api-gin/internal/globals.Version=${VERSION} -X kontor-api-gin/internal/globals.Commit=${COMMIT} -X kontor-api-gin/internal/globals.Date=${DATE}" -o kontor cmd/kontor/main.go
|
||||
|
||||
# ---------- Stage 2: Final ----------
|
||||
FROM alpine:latest
|
||||
|
||||
+9
-1
@@ -9,5 +9,13 @@ cd "$(dirname "$0")/.."
|
||||
source version
|
||||
|
||||
echo " => Baue Image localhost/kontor-gin:$kontorVersion"
|
||||
buildah build -t kontor-gin:$kontorVersion kontor-gin
|
||||
buildah build \
|
||||
-t kontor-gin:$kontorVersion \
|
||||
--build-arg VERSION=0.4.0-SNAPSHOT \
|
||||
--build-arg COMMIT=$(git rev-parse HEAD) \
|
||||
--build-arg DATE=$(date +%Y-%m-%dT%H:%M:%S) \
|
||||
kontor-gin
|
||||
|
||||
cd kontor-gin
|
||||
go build -ldflags "-X kontor-api-gin/internal/cmd.commit=`git rev-parse HEAD` -X kontor-api-gin/internal/cmd.version=0.4.0-SNAPSHOT -X kontor-api-gin/internal/cmd.date=`date +%Y-%m-%dT%H:%M:%S`" -o ~/.local/bin/kontor-cli cmd/kontor-cli/main.go
|
||||
go build -ldflags "-X kontor-api-gin/internal/globals.Version=0.4.0-SNAPSHOT -X kontor-api-gin/internal/globals.Commit=`git rev-parse HEAD` -X kontor-api-gin/internal/globals.Date=`date +%Y-%m-%dT%H:%M:%S`" -o ~/.local/bin/kontor cmd/kontor/main.go
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script/cibuild.inky:
|
||||
|
||||
set -e
|
||||
|
||||
go build -ldflags "-X kontor-api-gin/internal/cmd.commit=`git rev-parse HEAD` -X kontor-api-gin/internal/cmd.version=0.4.0-SNAPSHOT -X kontor-api-gin/internal/cmd.date=`date +%Y-%m-%dT%H:%M:%S`" -o ~/.local/bin/kontor-cli cmd/kontor-cli/main.go
|
||||
|
||||
go build -ldflags "-X kontor-api-gin/internal/globals.Version=0.4.0-SNAPSHOT -X kontor-api-gin/internal/globals.Commit=`git rev-parse HEAD` -X kontor-api-gin/internal/globals.Date=`date +%Y-%m-%dT%H:%M:%S`" -o ~/.local/bin/kontor cmd/kontor/main.go
|
||||
+1
-3
@@ -3,11 +3,11 @@ module kontor-api-gin
|
||||
go 1.26.8
|
||||
|
||||
require (
|
||||
github.com/JanikL/go-artemis v0.0.0-20250315150102-10f50406b94d
|
||||
github.com/gin-contrib/cors v1.7.2
|
||||
github.com/gin-contrib/sessions v1.1.2
|
||||
github.com/gin-contrib/slog v1.1.0
|
||||
github.com/gin-gonic/gin v1.12.0
|
||||
github.com/go-stomp/stomp/v3 v3.1.5
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/spf13/cobra v1.10.2
|
||||
@@ -32,8 +32,6 @@ require (
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.30.3 // indirect
|
||||
github.com/go-stomp/stomp v2.1.4+incompatible // indirect
|
||||
github.com/go-stomp/stomp/v3 v3.1.5 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
github.com/goccy/go-json v0.10.6 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
github.com/JanikL/go-artemis v0.0.0-20250315150102-10f50406b94d h1:kXaXwcE0eB92pqrluNv1/9IlSJyn56g8Kfl9KdFbHUM=
|
||||
github.com/JanikL/go-artemis v0.0.0-20250315150102-10f50406b94d/go.mod h1:vVJ6kbfbD0LWMirPFhis2ZZCg5kP6IZYAbRJEGBJwE0=
|
||||
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
|
||||
github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4=
|
||||
github.com/bytedance/sonic v1.15.4 h1:FgtV/4aBHpla9AxuMpuuzVUpa/Cf3izufkxNmnEzdI8=
|
||||
@@ -36,8 +34,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.30.3 h1:4MU6YkEwx7GbcPJOZxrtbu+QfF3pJLJuaYTeAH0DYy8=
|
||||
github.com/go-playground/validator/v10 v10.30.3/go.mod h1:4Axh7oCNGcoGkqLoE4YWt6n20mcEIsPRlB7vPk3lpyc=
|
||||
github.com/go-stomp/stomp v2.1.4+incompatible h1:D3SheUVDOz9RsjVWkoh/1iCOwD0qWjyeTZMUZ0EXg2Y=
|
||||
github.com/go-stomp/stomp v2.1.4+incompatible/go.mod h1:VqCtqNZv1226A1/79yh+rMiFUcfY3R109np+7ke4n0c=
|
||||
github.com/go-stomp/stomp/v3 v3.1.5 h1:Pikz1OSusmSKUm5mRKYfXQZaDatfZ+EnBBA1JJ2xENQ=
|
||||
github.com/go-stomp/stomp/v3 v3.1.5/go.mod h1:ztzZej6T2W4Y6FlD+Tb5n7HQP3/O5UNQiuC169pIp10=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "unset"
|
||||
commit = "unset"
|
||||
date = "unset"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show Kontor Version",
|
||||
Long: "Show Kontor Version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
slog.Info("version kontor")
|
||||
fmt.Println("Version: ", version)
|
||||
fmt.Println("Version: ", commit)
|
||||
fmt.Println("Version: ", date)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package globals
|
||||
|
||||
var Secret = []byte("secret")
|
||||
var (
|
||||
Secret = []byte("secret")
|
||||
|
||||
Version = "0.4.0"
|
||||
Commit = "unset"
|
||||
Date = "unset"
|
||||
)
|
||||
|
||||
const UserKey = "user"
|
||||
|
||||
const Version = "0.4.0"
|
||||
|
||||
Reference in New Issue
Block a user