Skip to content

Commit 728ebc0

Browse files
Merge pull request #18 from last9/fix/collector-release-tag-and-publish
Fix collector release: tag derivation + decouple GitHub release
2 parents ec9aa15 + 392e904 commit 728ebc0

3 files changed

Lines changed: 48 additions & 10 deletions

File tree

.github/workflows/collector-release.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,25 @@ jobs:
6767
id: semver
6868
env:
6969
REF_NAME: ${{ github.ref_name }}
70+
REF_TYPE: ${{ github.ref_type }}
7071
run: |
71-
semver="${REF_NAME#collector-}"
72+
if [ "$REF_TYPE" = "tag" ]; then
73+
tag="$REF_NAME"
74+
else
75+
# workflow_dispatch / branch run: fall back to the latest collector-v* tag
76+
tag="$(git describe --tags --abbrev=0 --match 'collector-v*')"
77+
fi
78+
if [ -z "$tag" ]; then
79+
echo "::error::no collector-v* tag found to release from" >&2
80+
exit 1
81+
fi
82+
# goreleaser (OSS) parses .Version from GORELEASER_CURRENT_TAG, so it
83+
# must be a bare semver (v0.2.0) with the "collector-" prefix stripped.
84+
# The GitHub release is published separately at the full tag below.
85+
semver="${tag#collector-}"
86+
echo "Releasing ${semver} (from ${tag})"
7287
echo "tag=${semver}" >> "$GITHUB_OUTPUT"
88+
echo "full_tag=${tag}" >> "$GITHUB_OUTPUT"
7389
7490
- name: Run goreleaser
7591
uses: goreleaser/goreleaser-action@v6
@@ -80,3 +96,24 @@ jobs:
8096
env:
8197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8298
GORELEASER_CURRENT_TAG: ${{ steps.semver.outputs.tag }}
99+
100+
- name: Publish GitHub release
101+
env:
102+
GH_TOKEN: ${{ github.token }}
103+
FULL_TAG: ${{ steps.semver.outputs.full_tag }}
104+
SEMVER: ${{ steps.semver.outputs.tag }}
105+
run: |
106+
# goreleaser left the archives + checksums in dist/ (release.disable).
107+
# Publish them at the namespaced collector-vX.Y.Z tag, idempotently so
108+
# re-runs of the same tag re-upload instead of failing.
109+
prerelease_flag=""
110+
case "$SEMVER" in *-*) prerelease_flag="--prerelease" ;; esac
111+
if gh release view "$FULL_TAG" >/dev/null 2>&1; then
112+
gh release upload "$FULL_TAG" dist/*.tar.gz dist/checksums.txt --clobber
113+
else
114+
gh release create "$FULL_TAG" \
115+
--title "l9gpu-collector ${SEMVER#v}" \
116+
--generate-notes \
117+
$prerelease_flag \
118+
dist/*.tar.gz dist/checksums.txt
119+
fi

.goreleaser.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ docker_manifests:
7575
checksum:
7676
name_template: "checksums.txt"
7777

78+
# goreleaser only builds the binaries/archives and pushes the docker image.
79+
# The GitHub release is published by the workflow via `gh release create` at
80+
# the full "collector-vX.Y.Z" tag. We can't let goreleaser publish it because
81+
# goreleaser (OSS) derives the release tag from the parsed semver (v0.2.0),
82+
# which is also owned by the Python release — they would collide.
7883
release:
79-
github:
80-
owner: last9
81-
name: gpu-telemetry
82-
prerelease: auto
83-
draft: false
84-
name_template: "l9gpu-collector {{ .Version }}"
84+
disable: "true"
8585

8686
changelog:
8787
sort: asc

docs/COLLECTOR.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ docker run --rm \
2727
Use `:latest` for tracking the newest release, or pin to a version:
2828

2929
```bash
30-
docker pull ghcr.io/last9/l9gpu-collector:collector-v0.1.0
30+
docker pull ghcr.io/last9/l9gpu-collector:v0.1.0
3131
```
3232

33-
Multi-arch (linux/amd64, linux/arm64). Docker picks the right image
34-
automatically.
33+
The docker image is published for `linux/amd64` only. For `linux/arm64`,
34+
use the binary tarball below (a native arm64 image will be added once an
35+
arm64 build runner is available).
3536

3637
### Kubernetes
3738

0 commit comments

Comments
 (0)