Skip to content

Commit

Permalink
Add kubectl plugin support (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Dec 9, 2020
1 parent cb5c279 commit 6fe6fa9
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@
project_name: ks
builds:
- env:
- CGO_ENABLED=0
- CGO_ENABLED=0
id: kubectl-ks
dir: kubectl-plugin
binary: kubectl-ks
goarch:
- amd64
- arm64
goos:
- windows
- linux
- darwin
hooks:
post:
- upx "{{ .Path }}"
ldflags:
- -X github.com/linuxsuren/cobra-extension/version.version={{.Version}}
- -X github.com/linuxsuren/cobra-extension/version.commit={{.ShortCommit}}
- -X github.com/linuxsuren/cobra-extension/version.date={{.Date}}
- -w
- env:
- CGO_ENABLED=0
id: "ks"
binary: ks
goarch:
- amd64
Expand All @@ -19,7 +40,7 @@ builds:
- -X github.com/linuxsuren/cobra-extension/version.commit={{.ShortCommit}}
- -X github.com/linuxsuren/cobra-extension/version.date={{.Date}}
- -w
dist: release
dist: bin
archives:
- name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
replacements:
Expand All @@ -45,8 +66,7 @@ changelog:
- '^docs:'
- '^test:'
brews:
-
name: ks
- name: ks
tap:
owner: linuxsuren
name: homebrew-linuxsuren
Expand All @@ -67,6 +87,7 @@ brews:
prefix.install_metafiles
nfpms:
- file_name_template: "{{ .Binary }}-{{.Os}}-{{.Arch}}"
id: "ks"
homepage: https://github.com/linuxsuren/ks
description: ks is a tiny tool for Chinese developers.
maintainer: rick <[email protected]>
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ BUILDFLAGS = -ldflags "-X github.com/linuxsuren/cobra-extension/version.version=
build: fmt
CGO_ENABLE=0 go build $(BUILDFLAGS) -o bin/ks

build-plugin: fmt
CGO_ENABLE=0 go build ${BUILDFLAGS} -o bin/kubectl-ks kubectl-plugin/*

fmt:
go fmt ./...

copy: build
sudo cp bin/ks /usr/local/bin/ks

copy-plugin: build-plugin
sudo cp bin/kubectl-ks /usr/local/bin/kubectl-ks

goreleaser-test:
goreleaser release --rm-dist --skip-publish --snapshot
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ module github.com/linuxsuren/ks
go 1.15

require (
github.com/imdario/mergo v0.3.9 // indirect
github.com/linuxsuren/cobra-extension v0.0.5
github.com/linuxsuren/go-cli-alias v0.0.4
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
k8s.io/apimachinery v0.19.4
k8s.io/cli-runtime v0.19.4
k8s.io/client-go v0.19.4
)
Loading

0 comments on commit 6fe6fa9

Please sign in to comment.