Skip to content

Commit c34b4e6

Browse files
committed
fix version flags in builds
1 parent 18cec9f commit c34b4e6

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
go-version: v1.25.4
2626
- name: Delete non-semver tags
2727
run: 'git tag -d $(git tag -l | grep -v "^v")'
28+
- name: Set LDFLAGS
29+
run: echo LDFLAGS="$(make ldflags)" >> $GITHUB_ENV
2830
- name: Run GoReleaser on tag
2931
if: github.event_name != 'pull_request'
3032
uses: goreleaser/goreleaser-action@v3

.goreleaser.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
version: 2
2+
3+
git:
4+
tag_sort: -version:refname
5+
ignore_tags:
6+
- "cli/*"
7+
- "sdk/*"
8+
29
builds:
310
- id: "kubectl-bind"
411
dir: cli
512
main: ./cmd/kubectl-bind
613
binary: bin/kubectl-bind
14+
ldflags:
15+
- "{{ .Env.LDFLAGS }}"
716
goos:
817
- linux
918
- darwin

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ helm-build-local: ## Build and package Helm charts locally for testing
482482
helm-clean: ## Clean up built helm charts
483483
rm -f ./bin/*.tgz
484484

485+
.PHONY: goreleaser-test
486+
goreleaser-test: ## Test GoReleaser flow locally
487+
@command -v goreleaser >/dev/null 2>&1 || { echo "goreleaser not found. Install from: https://goreleaser.com/install/"; exit 1; }
488+
LDFLAGS="$(LDFLAGS)" goreleaser release --snapshot --clean
489+
485490
.PHONY: helm-push-local
486491
helm-push-local: ## Push Helm charts to IMAGE_REPO registry
487492
@echo "Pushing Helm charts to registry: $(IMAGE_REPO)"

docs/content/setup/kubectl-plugin.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ The `kubectl bind` plugin is the primary command-line interface for interacting
3535

3636
```bash
3737
# Download and install for Linux/macOS
38-
curl -LO https://github.com/kube-bind/kube-bind/releases/latest/download/kubectl-bind-linux-amd64
39-
chmod +x kubectl-bind-linux-amd64
40-
sudo mv kubectl-bind-linux-amd64 /usr/local/bin/kubectl-bind
38+
OS=$(uname | tr '[:upper:]' '[:lower:]')
39+
ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
40+
VERSION=$(curl -s https://api.github.com/repos/kube-bind/kube-bind/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
41+
curl -LO https://github.com/kube-bind/kube-bind/releases/download/${VERSION}/kubectl-bind_${VERSION#v}_${OS}_${ARCH}.tar.gz
42+
tar -xzf kubectl-bind_${VERSION#v}_${OS}_${ARCH}.tar.gz
43+
sudo mv bin/kubectl-bind /usr/local/bin/kubectl-bind
4144
```
4245

4346
## Basic Usage

0 commit comments

Comments
 (0)