Skip to content

Commit

Permalink
Version v0.2.2
Browse files Browse the repository at this point in the history
- Automate binary version
  • Loading branch information
pabateman authored Dec 19, 2022
1 parent 44837ee commit 6c47f54
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-by-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master ]

env:
ARTIFACT_VERSION: ${{ github.ref }}

jobs:

build:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-by-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
ARTIFACT_VERSION: ${{ github.ref }}

jobs:

build:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release history

## v0.2.2

- Automate binary version

## v0.2.1

- Improve help tips
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ COMMIT := $(shell git rev-parse HEAD)
VERSION ?= $(shell git describe --always --tags)
GOOS ?= $(shell go env GOOS)
GOPATH ?= $(shell go env GOPATH)
ARTIFACT_VERSION ?= local

BUILDDIR := $(shell pwd)/out
PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64
Expand Down Expand Up @@ -66,12 +67,12 @@ all: lint build deploy
.PHONY: dev
dev: CGO_ENABLED := 1
dev:
go build -race -o $(PROJECT) cmd/$(PROJECT)/main.go
go build -race -o $(PROJECT) -ldflags="-X main.Version=$(ARTIFACT_VERSION)" cmd/$(PROJECT)/main.go

.PHONY: build
build: $(BUILDDIR)
cd cmd/$(PROJECT) && \
GOFLAGS="-trimpath" gox -osarch="$(PLATFORMS)" -output="$(BUILDDIR)/$(PROJECT)-{{.OS}}-{{.Arch}}" && \
GOFLAGS="-trimpath" gox -ldflags="-X main.Version=$(ARTIFACT_VERSION)" -osarch="$(PLATFORMS)" -output="$(BUILDDIR)/$(PROJECT)-{{.OS}}-{{.Arch}}" && \
cd ../..

.PHONY: lint
Expand Down
4 changes: 3 additions & 1 deletion cmd/kubectl-nsenter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
"time"
)

var Version = "local"

func main() {
app := &cli.App{
Name: "kubectl-nsenter",
Version: "v0.2.1",
Version: Version,
Compiled: time.Now(),
Authors: []*cli.Author{
{
Expand Down

0 comments on commit 6c47f54

Please sign in to comment.