Skip to content

Commit

Permalink
chore: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Telemaco019 committed May 19, 2024
1 parent 1c88ad0 commit 93a430e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
release:
types: [ created ]

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.3
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
# Go workspace file
go.work
go.work.sum
bin/
bin/
dist/
59 changes: 59 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
main: ./kubectl-duplicate/kubectl-duplicate.go
goos:
- linux
- windows
- darwin

brews:
- name: duplik8s
description: kubectl plugin to duplicate resources in a Kubernetes cluster.
homepage: https://github.com/Telemaco019/duplik8s
tap:
owner: Telemaco019
name: homebrew-duplik8s
commit_author:
name: Telemaco019
email: [email protected]
folder: Formula

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,24 @@ $(LOCALBIN):

## Tool Binaries
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
GORELEASER ?= $(LOCALBIN)/goreleaser
LICENSE_EYE ?= $(LOCALBIN)/license-eye
VHS ?= $(LOCALBIN)/vhs

## Tool Versions
GOLANGCI_LINT_VERSION ?= 1.50.1
GORELEASER_VERSION ?= 1.26.1

.PHONY: golangci-lint ## Download golanci-lint if necessary
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golanci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION}

.PHONY: goreleaser ## Download goreleaser if necessary
goreleaser: $(GORELEASER)
$(GORELEASER): $(LOCALBIN)
test -s $(LOCALBIN)/goreleaser || GOBIN=$(LOCALBIN) go install github.com/goreleaser/goreleaser@v${GORELEASER_VERSION}

.PHONY: license-eye ## Download license-eye if necessary
license-eye: $(LICENSE_EYE)
$(LICENSE_EYE): $(LOCALBIN)
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Duplik8s

🚧 Work in progress!

---

**Duplicate** 🔁 kubectl plugin to duplicate resources in a Kubernetes cluster.
Expand Down

0 comments on commit 93a430e

Please sign in to comment.