Skip to content

Commit

Permalink
adding github ci and krew support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Nichols committed Jan 13, 2020
1 parent 78f05e6 commit fca103b
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: ci
on:
push:
pull_request:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --snapshot --rm-dist
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new version in krew-index
uses: rajatjindal/[email protected]

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.Idea/

24 changes: 24 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
before:
hooks:
- go mod download
builds:
- id: kubectl-duck
main: ./kubectl-select
binary: kubectl-select
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64

archives:
- builds:
- kubectl-select
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: false
format: tar.gz
files:
- LICENSE
40 changes: 40 additions & 0 deletions .krew.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: select
spec:
version: {{ .TagName }}
homepage: https://github.com/n3wscott/kubectl-select
shortDescription: Select the active Kubernetes context using a tui.
description: |
This plugin allows you see all configured Kubernetes contexts as a human friendly list and use your arrow keys to select the active context.
caveats: |
* Contexts must already be setup in the local context file.
platforms:
- selector:
matchLabels:
os: darwin
arch: amd64
{{addURIAndSha "https://github.com/n3wscott/kubectl-select/releases/download/{{ .TagName }}/kubectl-select_{{ .TagName }}_darwin_amd64.tar.gz" .TagName }}
files:
- from: "*"
to: "."
bin: kubectl-select
- selector:
matchLabels:
os: linux
arch: amd64
{{addURIAndSha "https://github.com/n3wscott/kubectl-select/releases/download/{{ .TagName }}/kubectl-select_{{ .TagName }}_linux_amd64.tar.gz" .TagName }}
files:
- from: "*"
to: "."
bin: kubectl-select
- selector:
matchLabels:
os: windows
arch: amd64
{{addURIAndSha "https://github.com/n3wscott/kubectl-select/releases/download/{{ .TagName }}/kubectl-select_{{ .TagName }}_windows_amd64.tar.gz" .TagName }}
files:
- from: "*"
to: "."
bin: kubectl-select.exe
16 changes: 16 additions & 0 deletions kubectl-select.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 Scott Nichols <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
Expand Down

0 comments on commit fca103b

Please sign in to comment.