Skip to content

Commit

Permalink
ci: use goreleaser-cross for goreleaser-check command (#3806)
Browse files Browse the repository at this point in the history
Closes #3805

[goreleaser
v2.2.0](https://github.com/goreleaser/goreleaser/releases/tag/v2.2.0)
deprecated the `name_template` field in favor of `version_template`. Our
goreleaser-check command used a GH action that was using goreleaser
v2.2.0 so we fixed the deprecation in
#3797 but the make
prebuilt-binary command uses goreleaser-cross which was using a previous
version of goreleaser that fails for the new field.

This PR updates the goreleaser-check command to use the goreleaser-cross
Docker image so that the check command and prebuilt-binary command uses
the same version.

Note: we'll need to update `name_template` to `version_template` when we
upgrade to Go 1.23.0 because that will use goreleaser-cross 1.23.0 which
bumped to goreleaser 2.22.0. See
goreleaser/goreleaser-cross#77
  • Loading branch information
rootulp authored Aug 22, 2024
1 parent ad250dd commit 13f3098
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ jobs:
goreleaser-check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: goreleaser/goreleaser-action@v6
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v5
with:
version: latest
args: check
go-version-file: 'go.mod'
- name: Create .release-env file
run: |-
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_ACCESS_TOKEN}}' >> .release-env
- name: Check the .goreleaser.yaml config file
run: make goreleaser-check

goreleaser:
needs: goreleaser-check
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ archives:
checksum:
name_template: "checksums.txt"
snapshot:
version_template: "{{ incpatch .Version }}-next"
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ adr-gen:
@curl -sSL https://raw.githubusercontent.com/celestiaorg/.github/main/adr-template.md > docs/architecture/adr-template.md
.PHONY: adr-gen

## goreleaser-check: Check the .goreleaser.yaml config file.
goreleaser-check:
@if [ ! -f ".release-env" ]; then \
echo "A .release-env file was not found but is required to create prebuilt binaries. This command is expected to be run in CI where a .release-env file exists. If you need to run this command locally to attach binaries to a release, you need to create a .release-env file with a Github token (classic) that has repo:public_repo scope."; \
exit 1;\
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
check
.PHONY: goreleaser-check

## prebuilt-binary: Create prebuilt binaries and attach them to GitHub release. Requires Docker.
prebuilt-binary:
@if [ ! -f ".release-env" ]; then \
Expand Down

0 comments on commit 13f3098

Please sign in to comment.