Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .github/workflows/collector-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,25 @@ jobs:
id: semver
env:
REF_NAME: ${{ github.ref_name }}
REF_TYPE: ${{ github.ref_type }}
run: |
semver="${REF_NAME#collector-}"
if [ "$REF_TYPE" = "tag" ]; then
tag="$REF_NAME"
else
# workflow_dispatch / branch run: fall back to the latest collector-v* tag
tag="$(git describe --tags --abbrev=0 --match 'collector-v*')"
fi
if [ -z "$tag" ]; then
echo "::error::no collector-v* tag found to release from" >&2
exit 1
fi
# goreleaser (OSS) parses .Version from GORELEASER_CURRENT_TAG, so it
# must be a bare semver (v0.2.0) with the "collector-" prefix stripped.
# The GitHub release is published separately at the full tag below.
semver="${tag#collector-}"
echo "Releasing ${semver} (from ${tag})"
echo "tag=${semver}" >> "$GITHUB_OUTPUT"
echo "full_tag=${tag}" >> "$GITHUB_OUTPUT"

- name: Run goreleaser
uses: goreleaser/goreleaser-action@v6
Expand All @@ -80,3 +96,24 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.semver.outputs.tag }}

- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
FULL_TAG: ${{ steps.semver.outputs.full_tag }}
SEMVER: ${{ steps.semver.outputs.tag }}
run: |
# goreleaser left the archives + checksums in dist/ (release.disable).
# Publish them at the namespaced collector-vX.Y.Z tag, idempotently so
# re-runs of the same tag re-upload instead of failing.
prerelease_flag=""
case "$SEMVER" in *-*) prerelease_flag="--prerelease" ;; esac
if gh release view "$FULL_TAG" >/dev/null 2>&1; then
gh release upload "$FULL_TAG" dist/*.tar.gz dist/checksums.txt --clobber
else
gh release create "$FULL_TAG" \
--title "l9gpu-collector ${SEMVER#v}" \
--generate-notes \
$prerelease_flag \
dist/*.tar.gz dist/checksums.txt
fi
12 changes: 6 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ docker_manifests:
checksum:
name_template: "checksums.txt"

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

changelog:
sort: asc
Expand Down
7 changes: 4 additions & 3 deletions docs/COLLECTOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ docker run --rm \
Use `:latest` for tracking the newest release, or pin to a version:

```bash
docker pull ghcr.io/last9/l9gpu-collector:collector-v0.1.0
docker pull ghcr.io/last9/l9gpu-collector:v0.1.0
```

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

### Kubernetes

Expand Down
Loading