diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f25d738a65..dd265479e9 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -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 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c8ce5cff64..950143a3f1 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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: diff --git a/Makefile b/Makefile index d6e8bc2654..1ee024b0dc 100644 --- a/Makefile +++ b/Makefile @@ -191,6 +191,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 \