diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..22e9f01 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: release +on: + push: + tags: + - 'v*.*.*' +jobs: + job_build: + name: goreleaser and build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - name: check gopath + run: | + export GOPATH=$(go env GOPATH) + echo $GOPATH + - name: GoReleaser + uses: goreleaser/goreleaser-action@v2.4.1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.SECRET }} + GOPATH: /home/runner/go +# - name: Update new version in krew-index +# uses: rajatjindal/krew-release-bot@v0.0.38 diff --git a/.gitignore b/.gitignore index 05cd488..d9b8057 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea local_env.sh kubectl-cred +dist diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..6c05a4a --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,53 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +env: + - GO111MODULE=on +before: + hooks: + - go mod download +builds: + - binary: kubectl-cred + env: + - CGO_ENABLED=0 + goos: + - windows + - darwin + - linux + goarch: + - amd64 + asmflags: + - all=-trimpath={{.Env.GOPATH}} + gcflags: + - all=-trimpath={{.Env.GOPATH}} + ldflags: + - -s -w +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + amd64: x86_64 + format: tar.gz + name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + files: + - LICENSE + - README.md +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +release: + github: + owner: gjbae1212 + name: kubectl-cred +brews: + - name: kubectl-cred + tap: + owner: gjbae1212 + name: homebrew-kubectl-cred + commit_author: + name: gjbae1212 + email: gjbae1212@gmail.com + description: "kubectl-cred is a kubernetes plugin to which switch to contexts using an interactive CLI." diff --git a/.krew.yaml b/.krew.yaml new file mode 100644 index 0000000..0da4dd1 --- /dev/null +++ b/.krew.yaml @@ -0,0 +1,44 @@ +apiVersion: krew.googlecontainertools.github.com/v1alpha2 +kind: Plugin +metadata: + name: cred +spec: + version: {{ .TagName }} + homepage: https://github.com/gjbae1212/kubectl-cred + shortDescription: kubectl-cred is a kubernetes plugin to which switch to contexts and namespaces and clusters using an interactive CLI. + description: | + kubectl-cred is a kubernetes plugin to which switch to contexts and namespaces and clusters using an interactive CLI. + + # Switch context using an interactive CLI. + kubectl cred ctx + + # Switch namespace using an interactive CLI. + kubectl cred ns + + # Show your all of contexts information formatted tree. + kubectl cred ls + + # Show your current context information. + kubectl cred current + + # Rename context name in k8s config, using an interactive CLI. + kubectl cred rename + platforms: + - selector: + matchLabels: + os: darwin + arch: amd64 + {{addURIAndSha "https://github.com/gjbae1212/kubectl-cred/releases/download/{{ .TagName }}/kubectl-cred_{{ .TagName }}_Darwin_x86_64.tar.gz" .TagName }} + bin: kubectl-cred + - selector: + matchLabels: + os: linux + arch: amd64 + {{addURIAndSha "https://github.com/gjbae1212/kubectl-cred/releases/download/{{ .TagName }}/kubectl-cred_{{ .TagName }}_Linux_x86_64.tar.gz" .TagName }} + bin: kubectl-cred + - selector: + matchLabels: + os: windows + arch: amd64 + {{addURIAndSha "https://github.com/gjbae1212/kubectl-cred/releases/download/{{ .TagName }}/kubectl-cred_{{ .TagName }}_Windows_x86_64.tar.gz" .TagName }} + bin: kubectl-cred.exe diff --git a/cmd/root.go b/cmd/root.go index 544e894..7b66140 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -14,8 +14,8 @@ import ( var ( rootCmd = &cobra.Command{ Use: "kubectl-cred", - Short: color.CyanString(`kubectl-cred is an interactive CLI to be able to switch kubernetes context.`), - Long: color.CyanString(`kubectl-cred is an interactive CLI to be able to switch kubernetes context.`), + Short: color.CyanString(`kubectl-cred is a kubernetes plugin to which switch to contexts and namespaces and clusters using an interactive CLI.`), + Long: color.CyanString(`kubectl-cred is a kubernetes plugin to which switch to contexts and namespaces and clusters using an interactive CLI.`), Example: ` # Switch context using an interactive CLI. kubectl cred ctx