Skip to content

Commit 9c8f77d

Browse files
committed
wip
1 parent 87bf339 commit 9c8f77d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,29 @@ jobs:
5353
unzip -o lib/pip/bindata.go.zip -d lib/pip/
5454
5555
- name: Build
56+
id: build
5657
env:
5758
CGO_ENABLED: '0'
5859
GOOS: ${{ matrix.goos }}
5960
GOARCH: ${{ matrix.goarch }}
6061
run: |
62+
# Single source of truth: read the release version (TAG) and
63+
# release candidate (RC) straight from the Makefile.
64+
TAG=$(sed -n 's/^TAG[[:space:]]*=[[:space:]]*//p' Makefile | head -1 | tr -d '[:space:]')
65+
RC=$(sed -n 's/^RC[[:space:]]*=[[:space:]]*//p' Makefile | head -1 | tr -d '[:space:]')
66+
if [ -n "${RC}" ]; then RELEASE="${TAG}-${RC}"; else RELEASE="${TAG}"; fi
6167
BUILD=$(date +%Y%m%d%H%M)
62-
VERSION="${GITHUB_REF_NAME}-${GITHUB_SHA::7}"
63-
OUTPUT="philosopher-${GOOS}-${GOARCH}${{ matrix.ext }}"
68+
OUTPUT="philosopher-${RELEASE}${{ matrix.ext }}"
69+
echo "Building ${OUTPUT} (version=${TAG}, build=${BUILD})"
6470
go build -trimpath \
65-
-ldflags "-w -s -X main.version=${VERSION} -X main.build=${BUILD}" \
71+
-ldflags "-w -s -X main.version=${TAG} -X main.build=${BUILD}" \
6672
-o "${OUTPUT}" main.go
6773
ls -lh "${OUTPUT}"
74+
echo "output=${OUTPUT}" >> "$GITHUB_OUTPUT"
6875
6976
- name: Upload artifact
7077
uses: actions/upload-artifact@v4
7178
with:
72-
name: philosopher-${{ matrix.goos }}-${{ matrix.goarch }}
73-
path: philosopher-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}
79+
name: ${{ steps.build.outputs.output }}
80+
path: ${{ steps.build.outputs.output }}
7481
if-no-files-found: error

0 commit comments

Comments
 (0)