From 5e41bc2ac2fbc2b8e7a131bf8b719fd1c1c2d848 Mon Sep 17 00:00:00 2001 From: Dmytro Bondar Date: Sat, 1 Jul 2023 11:02:24 +0200 Subject: [PATCH 1/3] Added goreleaser config --- .gitignore | 1 + .goreleaser.yaml | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .goreleaser.yaml diff --git a/.gitignore b/.gitignore index 8e93598b..c4b72bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ release/ .envrc .idea docker-run-release-cache/ +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..0ade6808 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,51 @@ +--- +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # Keep mod files clean + - go mod tidy -v + +builds: + - main: main.go + binary: bin/diff + env: + - CGO_ENABLED=0 + flags: -trimpath + ldflags: -s -w -X {{ .ModulePath }}/cmd.Version={{ .Version }} + targets: + # helm supported targets + # https://github.com/helm/helm/blob/main/Makefile#L4C1-L4C1 + - darwin_amd64 + - darwin_arm64 + - linux_386 + - linux_amd64 + - linux_arm + - linux_arm64 + - linux_ppc64le + - linux_s390x + - windows_amd64 + # additional targets + - freebsd_amd64 + +archives: + - format: tgz + name_template: '{{ .ProjectName }}-{{ tolower .Os }}-{{ .Arch }}' + wrap_in_directory: diff + files: + - README.md + - LICENSE + - plugin.yaml + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: '{{ incpatch .Version }}-{{ .ShortCommit }}' + +changelog: + sort: asc + filters: + exclude: + - '^chore:' + - '^docs:' + - '^test:' From 692c116456bd661456ac767b67e1b08624c2f487 Mon Sep 17 00:00:00 2001 From: Dmytro Bondar Date: Mon, 3 Jul 2023 15:45:46 +0200 Subject: [PATCH 2/3] Add release workflow --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ Makefile | 2 +- scripts/release.sh | 1 - 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..52b05e71 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: release + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Check versions + run: | + version=$(grep "^version:" plugin.yaml | cut -d '"' -f 2) + if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then + echo '::error::Version mismatch' + exit 1 + fi + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - uses: goreleaser/goreleaser-action@v4 + with: + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index bf4cf3cf..14be08f3 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ dist: tar -C build/ -zcvf $(CURDIR)/release/helm-diff-windows-amd64.tgz diff/ .PHONY: release -release: lint dist +release: lint scripts/release.sh v$(VERSION) # Test for the plugin installation with `helm plugin install -v THIS_BRANCH` works diff --git a/scripts/release.sh b/scripts/release.sh index 9ca0716b..2627c9fa 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -8,4 +8,3 @@ fi git tag $1 git push origin $1 -gh release create $1 --draft --generate-notes --title "$1" release/*.tgz From 7d4ce1ff290627f9db547fbec46ff59337c82b92 Mon Sep 17 00:00:00 2001 From: Dmytro Bondar Date: Tue, 25 Jul 2023 09:43:02 +0200 Subject: [PATCH 3/3] Update workflow name --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 52b05e71..ad917cf2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: release +name: Release on: push: