Skip to content

Commit 74e63ed

Browse files
authored
Fix goreleaser config. (#627)
The 'replacements' parameter was removed in goreleaser. The name now has to be built directly in the file-name template. (See: goreleaser/goreleaser#3588 (comment)) Also updates the branches workflow to directly create+commit to the new branch using the prebuilt GITHUB_TOKEN. This token has by default only read permissions, so write permissions are added to allow it create branches and commit.
1 parent 84fca92 commit 74e63ed

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

.github/workflows/branch.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
tags:
77
- '*.*.*'
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
branch-out:
1114
name: Create a github branch
@@ -31,22 +34,15 @@ jobs:
3134
go-version: "1.20"
3235
id: go
3336

34-
- name: Bump main version
37+
- name: Bump patch version
3538
run: make patch
3639

37-
- name: Create a github branch
38-
uses: peterjgrainger/action-create-branch@v2.4.0
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GH_TOKEN }}
41-
with:
42-
branch: ${{ steps.get_branch.outputs.BRANCH }}
43-
44-
- name: Commit changes to the minor branch
40+
- name: Create new branch and commit changes to the minor branch
4541
uses: EndBug/add-and-commit@v9
4642
with:
4743
default_author: user_info
4844
message: 'Update patch version'
49-
branch: ${{ steps.get_branch.outputs.BRANCH }}
45+
new_branch: ${{ steps.get_branch.outputs.BRANCH }}
5046
author_name: elasticcloudclients
5147
author_email: elasticcloudclients@elastic.co
5248

@@ -59,7 +55,7 @@ jobs:
5955
with:
6056
ref: master
6157
fetch-depth: 0
62-
token: ${{ secrets.GH_TOKEN_EXTRA }}
58+
token: ${{ secrets.GITHUB_TOKEN }}
6359

6460
- name: Set up Go
6561
uses: actions/setup-go@v4

.goreleaser.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ builds:
2323
- arm64
2424
ignore:
2525
- goos: darwin
26-
goarch: 386
26+
goarch: "386"
2727
ldflags: -s -w -X main.version={{.Env.VERSION }} -X main.commit={{.Commit}} -X main.owner={{.Env.OWNER}} -X main.repo={{.Env.REPO}} -X main.built={{.Env.BUILT}}
2828
binary: ecctl
2929
archives:
@@ -36,15 +36,16 @@ archives:
3636
snapshot:
3737
name_template: "{{ .Version }}_SNAPSHOT_{{ .ShortCommit }}"
3838
nfpms:
39-
- file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
39+
- file_name_template: >-
40+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_
41+
{{- if eq .Arch "amd64" }}64-bit
42+
{{- else if eq .Arch "386" }}32-bit
43+
{{- else }}{{ .Arch }}{{ end }}
4044
license: Apache 2.0
4145
maintainer: Elastic Cloud
4246
vendor: Elastic
4347
description: ecctl is the CLI for the Elasticsearch Service and Elastic Cloud Enterprise APIs.
4448
homepage: https://www.elastic.co/guide/en/ecctl/current/index.html
45-
replacements:
46-
amd64: 64-bit
47-
"386": 32-bit
4849
formats:
4950
- deb
5051
- rpm

build/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ifneq ($(SKIP_TAG),true)
4747
endif
4848
@ echo "-> Releasing $(BINARY) $(VERSION)..."
4949
@ okta-awscli
50-
@ $(GOBIN)/goreleaser release --skip-validate --rm-dist --release-notes=notes/$(VERSION).md
50+
@ $(GOBIN)/goreleaser release --skip=validate --clean --release-notes=notes/$(VERSION).md
5151

5252
## Generates a changelog file in notes/$(VERSION) for the next release.
5353
changelog:

build/Makefile.deps

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VERSION_DIR:=$(GOBIN)/versions
77
VERSION_GOLICENSER:=v0.3.0
88
VERSION_GOLANGCILINT:=v1.54.2
99
VERSION_GOBINDATA:=v0.0.0-20190711162640-ee3c2418e368
10-
VERSION_GORELEASER:=v1.2.5
10+
VERSION_GORELEASER:=v1.21.2
1111
VERSION_VERSIONBUMP:=v1.1.0
1212

1313
deps: $(GOBIN)/go-licenser $(GOBIN)/golangci-lint $(GOBIN)/go-bindata
@@ -48,7 +48,7 @@ $(VERSION_DIR)/.version-goreleaser-$(VERSION_GORELEASER): | $(VERSION_DIR)
4848

4949
$(GOBIN)/goreleaser: $(VERSION_DIR)/.version-goreleaser-$(VERSION_GORELEASER) | $(GOBIN)
5050
@ echo "-> Installing goreleaser..."
51-
@ curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh| sh -s -- -b $(GOBIN) $(VERSION_GORELEASER)
51+
@ go install github.com/goreleaser/goreleaser@$(VERSION_GORELEASER)
5252

5353
$(VERSION_DIR)/.version-versionbump-$(VERSION_VERSIONBUMP): | $(VERSION_DIR)
5454
@ rm -f $(VERSION_DIR)/.version-versionbump-*

0 commit comments

Comments
 (0)