Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate build workflow to GoReleaser and GitHub CI #23

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags: ["*"]

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Needed for GoReleaser to work properly
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new version in krew-index
uses: rajatjindal/[email protected]
with:
krew_template_file: dist/doctor.yaml
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
kubectl-doctor
*~
.idea/

# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -15,11 +11,15 @@ kubectl-doctor
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Ignore vendor files
vendor/*
# Dependency directories
vendor/

# Ignore binary releases
releases/*
# GoLand
.idea/

# GoReleaser
dist/

# Ignore garbage
.DS_Store
# General
.DS_Store
*~
67 changes: 67 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

archives:
- files:
- LICENSE
format: zip

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
- windows
- darwin
ldflags:
- -s -w
main: ./cmd
mod_timestamp: "{{ .CommitTimestamp }}"

changelog:
groups:
- title: Features
regexp: "^.*feat(?:(\\w))*:+.*$"
order: 0
- title: Bug fixes
regexp: "^.*fix(?:(\\w))*:+.*$"
order: 1
- title: Others
order: 999
use: github

checksum:
name_template: "checksums.txt"

krews:
- name: doctor
caveats: |
This plugin needs higher privileges on core API group.
Potentially a ClusterRole that can get cluster-scoped resources.
Such as nodes / all namespaces etc.
description: |
This plugin is inspired by brew doctor.
It will scan the active kube-context for anomalies or
useful action points that it can report back to you.
This plugin does not change any state or configuration.

Please check the repository for an example report:

* https://github.com/emirozer/kubectl-doctor
homepage: https://github.com/emirozer/kubectl-doctor
short_description: Scans your cluster and reports anomalies
skip_upload: "true"

release:
disable: false
prerelease: auto

snapshot:
name_template: "{{ incpatch .Version }}-next"
56 changes: 0 additions & 56 deletions Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ This plugin does *not* change any state or configuration, it merely just scans a
2. Unzip to get `kubectl-doctor` (or `kubectl-doctor.exe` if windows)
3. Add it to your `PATH`

### Using [Krew](https://krew.sigs.k8s.io/)
```sh
$ kubectl krew install doctor
```

## Usage
When the plugin binary is found from `PATH` you can just execute it through `kubectl` CLI
```shell
Expand Down
72 changes: 0 additions & 72 deletions doctor.yaml

This file was deleted.

Loading