6 Commits

Author SHA1 Message Date
dcefb2502f Updated to Hub
All checks were successful
build-binaries / build (, amd64, linux) (push) Successful in 1m5s
build-binaries / build (, arm, 7, linux) (push) Successful in 1m5s
build-binaries / build (, arm64, linux) (push) Successful in 1m8s
build-binaries / build (.exe, amd64, windows) (push) Successful in 1m8s
build-binaries / release (push) Successful in 25s
build-binaries / publish-agent (push) Successful in 14s
release-tag / release-image (push) Successful in 3m0s
2025-10-26 02:26:29 +01:00
afbd69d695 Update to Go-1.25.3
All checks were successful
build-binaries / build (, amd64, linux) (push) Has been skipped
build-binaries / build (, arm, 7, linux) (push) Has been skipped
build-binaries / build (, arm64, linux) (push) Has been skipped
build-binaries / build (.exe, amd64, windows) (push) Has been skipped
build-binaries / release (push) Has been skipped
release-tag / release-image (push) Successful in 5m53s
2025-10-21 07:26:11 +02:00
0e66267d39 main.go aktualisiert
All checks were successful
release-tag / release-image (push) Successful in 2m17s
build-binaries / build (, amd64, linux) (push) Successful in 49s
build-binaries / build (, arm, 7, linux) (push) Successful in 46s
build-binaries / build (, arm64, linux) (push) Successful in 46s
build-binaries / build (.exe, amd64, windows) (push) Successful in 47s
build-binaries / release (push) Successful in 19s
2025-10-15 11:09:59 +00:00
7a88b0c407 main.go aktualisiert
Some checks failed
release-tag / release-image (push) Has been cancelled
build-binaries / build (, amd64, linux) (push) Successful in 46s
build-binaries / build (, arm, 7, linux) (push) Successful in 44s
build-binaries / build (, arm64, linux) (push) Successful in 45s
build-binaries / build (.exe, amd64, windows) (push) Successful in 47s
build-binaries / release (push) Successful in 18s
2025-10-15 08:34:09 +00:00
ac786f6eab Dockerfile aktualisiert
Some checks failed
release-tag / release-image (push) Has been cancelled
build-binaries / build (, amd64, linux) (push) Has been cancelled
build-binaries / build (, arm, 7, linux) (push) Has been cancelled
build-binaries / build (, arm64, linux) (push) Has been cancelled
build-binaries / build (.exe, amd64, windows) (push) Has been cancelled
build-binaries / release (push) Has been cancelled
2025-10-15 08:33:40 +00:00
d65f53d00f Dockerfile aktualisiert
Some checks failed
build-binaries / build (, amd64, linux) (push) Has been cancelled
build-binaries / build (, arm, 7, linux) (push) Has been cancelled
build-binaries / build (, arm64, linux) (push) Has been cancelled
build-binaries / build (.exe, amd64, windows) (push) Has been cancelled
release-tag / release-image (push) Has been cancelled
build-binaries / release (push) Has been cancelled
2025-10-15 08:33:20 +00:00
4 changed files with 98 additions and 14 deletions

View File

@@ -122,3 +122,91 @@ jobs:
files: |
dist/**/status-dashboard-*.tar.gz
dist/**/status-dashboard-*.zip
publish-agent:
if: startsWith(github.ref, 'refs/tags/')
needs: release
runs-on: ubuntu-fast
env:
PRODUCT: status-dashboard
AGENT_URL: ${{ secrets.AGENT_URL }}
AGENT_TOKEN: ${{ secrets.AGENT_TOKEN }}
# Funktioniert in GitHub und Gitea (Actions) weitgehend gleich:
SERVER_URL: ${{ github.server_url }} # z.B. https://github.com oder https://gitea.example.com
REPOSITORY: ${{ github.repository }} # owner/repo
TAG: ${{ github.ref_name }} # vX.Y.Z
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./dist
- name: Publish release metadata to Version Agent
shell: bash
run: |
set -euo pipefail
if [[ -z "${AGENT_URL:-}" || -z "${AGENT_TOKEN:-}" ]]; then
echo "Missing AGENT_URL or AGENT_TOKEN" >&2; exit 1
fi
VERSION="${TAG#v}" # 12.3.1[-rc.1|-beta.1]
MAJOR="${VERSION%%.*}" # 12
BRANCH="${MAJOR}.x" # 12.x
CHANNEL="stable"
[[ "$VERSION" == *"-rc"* ]] && CHANNEL="rc"
[[ "$VERSION" == *"-beta"* ]] && CHANNEL="beta"
# Optional: Nightly-Channel bei Non-Tag-Builds (separater Job, siehe unten)
RELEASED_AT="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
NOTES_URL="${SERVER_URL}/${REPOSITORY}/releases/tag/${TAG}"
publish() { # args: OS ARCH FILE
local OS="$1" ARCH="$2" FILE="$3"
local BIT="64"
case "$ARCH" in 386|armv7) BIT="32";; esac
local FNAME="$(basename "$FILE")"
local URL="${SERVER_URL}/${REPOSITORY}/releases/download/${TAG}/${FNAME}"
local SHA256 SIZE
SHA256="$(sha256sum "$FILE" | awk '{print $1}')"
SIZE="$(stat -c%s "$FILE")"
jq -n \
--arg branch "$BRANCH" \
--arg channel "$CHANNEL" \
--arg arch "$ARCH" \
--arg bit "$BIT" \
--arg os "$OS" \
--arg version "$VERSION" \
--arg released_at "$RELEASED_AT" \
--arg notes "$NOTES_URL" \
--arg url "$URL" \
--arg sha256 "$SHA256" \
--argjson size "$SIZE" \
'{
branch:$branch, channel:$channel, arch:$arch, bit:$bit, os:$os,
release:{
version:$version, released_at:$released_at, notes_url:$notes,
assets:[{url:$url, sha256:$sha256, size_bytes:$size}]
}
}' > payload.json
echo @payload.json
curl -fsS -H "Content-Type: application/json" \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-d @payload.json "${AGENT_URL}/v1/publish"
}
shopt -s nullglob
# linux/amd64
for f in dist/**/${PRODUCT}-linux-amd64.tar.gz; do publish linux amd64 "$f"; done
# linux/arm64
for f in dist/**/${PRODUCT}-linux-arm64.tar.gz; do publish linux arm64 "$f"; done
# linux/armv7
for f in dist/**/${PRODUCT}-linux-armv7.tar.gz; do publish linux armv7 "$f"; done
# windows/amd64
for f in dist/**/${PRODUCT}-windows-amd64.zip; do publish windows amd64 "$f"; done

View File

@@ -1,4 +1,4 @@
FROM golang:1.24.4
FROM golang:1.25
WORKDIR /app
COPY go.mod ./
RUN go mod download
@@ -6,6 +6,7 @@ COPY *.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /goprg
RUN mkdir /data
COPY services.json /data/services.json
##COPY services.json /services.json
VOLUME ["/data"]
EXPOSE 8080
CMD ["/goprg"]

2
go.mod
View File

@@ -1,3 +1,3 @@
module git.send.nrw/sendnrw/status-dashboard
go 1.24.4
go 1.25.3

19
main.go
View File

@@ -190,7 +190,7 @@ func envOr(k, def string) string {
func main() {
addr := envOr("addr", ":8080")
cfgPath := envOr("config", ".\services.json")
cfgPath := envOr("config", "./services.json")
state := newState()
@@ -318,17 +318,12 @@ func writeJSON(w http.ResponseWriter, v any) {
_ = enc.Encode(v)
}
func readConfig(path string) (*Config, error) {
var cfg Config
f, err := http.Dir(".").Open(path) // schlichtes Lesen aus CWD
if err != nil {
return nil, err
}
defer f.Close()
if err := json.NewDecoder(f).Decode(&cfg); err != nil {
return nil, err
}
return &cfg, nil
func readConfig(p string) (*Config, error) {
b, err := os.ReadFile(p)
if err != nil { return nil, err }
var cfg Config
if err := json.Unmarshal(b, &cfg); err != nil { return nil, err }
return &cfg, nil
}
var buildTime = time.Now()