From 3f93c1ca2f61156b666edf3e995d2c4409185e97 Mon Sep 17 00:00:00 2001 From: scip Date: Mon, 10 Aug 2026 13:19:48 +0200 Subject: [PATCH 1/3] add release build script --- .gitignore | 2 +- mkrel.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100755 mkrel.sh diff --git a/.gitignore b/.gitignore index 6d6e230..9d725f2 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ go.work.sum esctl -*.sh + *.json *.log diff --git a/mkrel.sh b/mkrel.sh new file mode 100755 index 0000000..7cb3fcb --- /dev/null +++ b/mkrel.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +set -e + +# +# Copyright © 2023-2024 Thomas von Dein +# Copyright 2024 Finanz Informatik Technologie Service GmbH & Co KG +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# get list with: go tool dist list +DIST="linux/amd64 +windows/amd64 +darwin/amd64" + +tool="$1" +BRANCH="$2" +COMMIT="$3" +GOVERSION="$4" +APIVERSION="$5" +version="$6" + +rm -rf releases +mkdir -p releases + +for D in $DIST; do + os=${D/\/*/} + arch=${D/*\//} + binfile="releases/${tool}-${os}-${arch}-${version}" + + case "$os" in + windows) + binfile="${binfile}.exe" + ;; + esac + + set -x + GOOS=${os} GOARCH=${arch} go build -tags osusergo,netgo \ + -ldflags "-extldflags=-static -X github.com/fi-ts/esctl/pkg/cfg.BRANCH=${BRANCH} -X github.com/fi-ts/esctl/pkg/cfg.COMMIT=${COMMIT} -X github.com/fi-ts/esctl/pkg/cfg.GOVERSION=${GOVERSION} -X github.com/fi-ts/esctl/pkg/cfg.APIVERSION=${APIVERSION} -X github.com/fi-ts/esctl/pkg/cfg.BUILD=${BUILD}" -o "${binfile}" + + sha256sum ${binfile} | cut -d' ' -f1 > ${binfile}.sha256 + set +x +done + From cfa451564fa09615cbca7c82eee3844a6c3f3f62 Mon Sep 17 00:00:00 2001 From: scip Date: Mon, 10 Aug 2026 13:33:42 +0200 Subject: [PATCH 2/3] debug --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3a1c9dd..fa05443 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,8 +17,11 @@ jobs: with: go-version: 1.26.4 + - name: show current branch + run: git branch --show-current + - name: Build the executables - run: make release + run: make release BRANCH=${{ github.ref_name}} - name: List the executables run: ls -l ./releases From d920d8361cd134627e7ae9d79d52182647cb3d4d Mon Sep 17 00:00:00 2001 From: scip Date: Mon, 10 Aug 2026 13:38:45 +0200 Subject: [PATCH 3/3] fix branch arg --- .github/workflows/release.yaml | 5 +---- Makefile | 2 +- mkrel.sh | 14 +++++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fa05443..3a1c9dd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,11 +17,8 @@ jobs: with: go-version: 1.26.4 - - name: show current branch - run: git branch --show-current - - name: Build the executables - run: make release BRANCH=${{ github.ref_name}} + run: make release - name: List the executables run: ls -l ./releases diff --git a/Makefile b/Makefile index 832a266..8276d44 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ goupdate: go get -t -u=patch ./... release: - ./mkrel.sh $(tool) $(BRANCH) $(COMMIT) $(GOVERSION) $(APIVERSION) $(VERSION) + ./mkrel.sh $(tool) $(COMMIT) $(GOVERSION) $(APIVERSION) $(VERSION) $(BRANCH) show-versions: buildlocal @echo "### esctl version:" diff --git a/mkrel.sh b/mkrel.sh index 7cb3fcb..7ea8b9d 100755 --- a/mkrel.sh +++ b/mkrel.sh @@ -25,11 +25,15 @@ windows/amd64 darwin/amd64" tool="$1" -BRANCH="$2" -COMMIT="$3" -GOVERSION="$4" -APIVERSION="$5" -version="$6" +COMMIT="$2" +GOVERSION="$3" +APIVERSION="$4" +version="$5" +BRANCH="$6" + +if test -z "$BRANCH"; then + BRANCH=main +fi rm -rf releases mkdir -p releases