Skip to content

Commit

Permalink
Merge pull request #4 from kei6u/refactoring
Browse files Browse the repository at this point in the history
- Add goreleaser to GitHub Actions.
- Refactor the whole of source code to simplify logic and implement unit tests.
- Support flags from `kubectl options`.
- Support `--selector, -l` flag to filter secrets.
- Enhance the command help.
  • Loading branch information
keisku authored Jan 8, 2022
2 parents 4d8d82e + c4e1148 commit cfbbb73
Show file tree
Hide file tree
Showing 14 changed files with 1,164 additions and 511 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/go_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on: [push, pull_request]
name: go test
jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: go vet
run: go vet ./...
- name: go test
run: go test -v ./...
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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.17
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 0 additions & 17 deletions .github/workflows/test.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
kubectl-secretdata**
42 changes: 18 additions & 24 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
release:

before:
hooks:
- go mod tidy

- go mod download
builds:
- id: kubectl-secret-data
binary: kubectl-secret-data
ldflags:
- -s -w
- -X main.Version={{.Version}}
- id: kubectl-secretdata
binary: kubectl-secretdata
env:
- CGO_ENABLED=0
goos:
- windows
- darwin
- linux
- linux
- darwin
- windows
goarch:
- arm64
- amd64
- ppc64le
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64

archives:
- builds:
- kubectl-secret-data
replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
- kubectl-secretdata
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: "false"
format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright 2021 Keisuke Umegaki
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2022 Keisuke Umegaki <[email protected]>

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit cfbbb73

Please sign in to comment.