From 0491ac552e15b81ea62fb3114265e0c2f6cbbbdc Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 29 Apr 2020 13:18:14 -0700 Subject: [PATCH] Add goreleaser and github workflows Signed-off-by: Ahmet Alp Balkan --- .github/workflows/ci.yml | 19 +++++++++++ .github/workflows/release.yml | 28 ++++++--------- .goreleaser.yml | 64 +++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..04b70a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: Go implementation (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.14 + - name: GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --snapshot --skip-publish --rm-dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf216ee..d8dca45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,23 @@ -name: release +name: Release on: push: tags: - 'v*.*.*' jobs: - release: + goreleaser: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@master - - name: Create Release - id: create_release - uses: actions/create-release@v1 + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.14 + - name: GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - - name: Update new version for plugin 'ctx' in krew-index - uses: rajatjindal/krew-release-bot@v0.0.37 - with: - krew_template_file: .krew/ctx.yaml - - name: Update new version for plugin 'ns' in krew-index - uses: rajatjindal/krew-release-bot@v0.0.37 - with: - krew_template_file: .krew/ns.yaml - diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..3a9829a --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,64 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go mod download +builds: +- id: kubectx + main: ./cmd/kubectx + binary: kubectx + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 +- id: kubens + main: ./cmd/kubens + binary: kubens + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 +archives: +- id: kubectx-archive + name_template: "kubectx_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + builds: + - kubectx + replacements: + 386: i386 + amd64: x86_64 + format_overrides: + - goos: windows + format: zip + files: ["LICENSE"] +- id: kubens-archive + name_template: "kubens_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + builds: + - kubens + replacements: + 386: i386 + amd64: x86_64 + format_overrides: + - goos: windows + format: zip + files: ["LICENSE"] +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +checksum: + name_template: "checksums.txt" + algorithm: sha256 +release: + extra_files: + - glob: ./kubens + - glob: ./kubectx