Skip to content

Commit

Permalink
Fix goreleaser config. (#627)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gigerdo committed Oct 23, 2023
1 parent 84fca92 commit 74e63ed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/branch.yml
Expand Up @@ -6,6 +6,9 @@ on:
tags:
- '*.*.*'

permissions:
contents: write

jobs:
branch-out:
name: Create a github branch
Expand All @@ -31,22 +34,15 @@ jobs:
go-version: "1.20"
id: go

- name: Bump main version
- name: Bump patch version
run: make patch

- name: Create a github branch
uses: peterjgrainger/action-create-branch@v2.4.0
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GH_TOKEN }}
with:
branch: ${{ steps.get_branch.outputs.BRANCH }}

- name: Commit changes to the minor branch
- name: Create new branch and commit changes to the minor branch
uses: EndBug/add-and-commit@v9
with:
default_author: user_info
message: 'Update patch version'
branch: ${{ steps.get_branch.outputs.BRANCH }}
new_branch: ${{ steps.get_branch.outputs.BRANCH }}
author_name: elasticcloudclients
author_email: elasticcloudclients@elastic.co

Expand All @@ -59,7 +55,7 @@ jobs:
with:
ref: master
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_EXTRA }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v4
Expand Down
11 changes: 6 additions & 5 deletions .goreleaser.yml
Expand Up @@ -23,7 +23,7 @@ builds:
- arm64
ignore:
- goos: darwin
goarch: 386
goarch: "386"
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}}
binary: ecctl
archives:
Expand All @@ -36,15 +36,16 @@ archives:
snapshot:
name_template: "{{ .Version }}_SNAPSHOT_{{ .ShortCommit }}"
nfpms:
- file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- file_name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_
{{- if eq .Arch "amd64" }}64-bit
{{- else if eq .Arch "386" }}32-bit
{{- else }}{{ .Arch }}{{ end }}
license: Apache 2.0
maintainer: Elastic Cloud
vendor: Elastic
description: ecctl is the CLI for the Elasticsearch Service and Elastic Cloud Enterprise APIs.
homepage: https://www.elastic.co/guide/en/ecctl/current/index.html
replacements:
amd64: 64-bit
"386": 32-bit
formats:
- deb
- rpm
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.build
Expand Up @@ -47,7 +47,7 @@ ifneq ($(SKIP_TAG),true)
endif
@ echo "-> Releasing $(BINARY) $(VERSION)..."
@ okta-awscli
@ $(GOBIN)/goreleaser release --skip-validate --rm-dist --release-notes=notes/$(VERSION).md
@ $(GOBIN)/goreleaser release --skip=validate --clean --release-notes=notes/$(VERSION).md

## Generates a changelog file in notes/$(VERSION) for the next release.
changelog:
Expand Down
4 changes: 2 additions & 2 deletions build/Makefile.deps
Expand Up @@ -7,7 +7,7 @@ VERSION_DIR:=$(GOBIN)/versions
VERSION_GOLICENSER:=v0.3.0
VERSION_GOLANGCILINT:=v1.54.2
VERSION_GOBINDATA:=v0.0.0-20190711162640-ee3c2418e368
VERSION_GORELEASER:=v1.2.5
VERSION_GORELEASER:=v1.21.2
VERSION_VERSIONBUMP:=v1.1.0

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

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

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

0 comments on commit 74e63ed

Please sign in to comment.