diff --git a/.gitignore b/.gitignore index 2a8c4654a1..7d7c0b98e3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ run.sh testing/e2e/networks/*/ square/testdata **/*.html +.release-env +**/*.DS_Store diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ae0c789a45..47d76e8947 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,40 +1,80 @@ -# This is an example .goreleaser.yml file with some sensible defaults. -# Make sure to check the documentation at https://goreleaser.com - -# NOTE: CGO is required for ledger support to work, however goreleaser -# technically doesn't support CGO. But it seems to work so that's cool. This -# only seems to work because we are building for a single binary. Cross -# compiling binaries for multiple distributions doesn't work and a proper -# workaround will be needed. -# -# REF: https://goreleaser.com/limitations/cgo/ - +# Ledger support is only available if the binary is built with CGO enabled. +# Since GoReleaser doesn't support CGO natively, our GoReleaser process builds +# binaries in a Docker image maintained by goreleaser-cross that has CGO support +# for multiple platforms. See https://github.com/goreleaser/goreleaser-cross before: hooks: - go mod tidy builds: - - main: ./cmd/celestia-appd + - id: darwin-amd64 + main: ./cmd/celestia-appd binary: celestia-appd env: - SDKPath={{ "github.com/cosmos/cosmos-sdk/version" }} + - CGO_ENABLED=1 + # CC and CXX are required for CGO to work. See + # https://github.com/goreleaser/goreleaser-cross#supported-toolchainsplatforms + - CC=o64-clang + - CXX=o64-clang++ goarch: - amd64 - - arm64 goos: - darwin - - linux tags: - ledger ldflags: # Ref: https://goreleaser.com/customization/templates/#common-fields - # + # .Version is the version being released # .FullCommit is git commit hash goreleaser is using for the release - # + - -X "{{ .Env.SDKPath }}.Name=celestia-app" + - -X "{{ .Env.SDKPath }}.AppName=celestia-appd" + - -X "{{ .Env.SDKPath }}.Version={{ .Version }}" + - -X "{{ .Env.SDKPath }}.Commit={{ .FullCommit }}" + - id: darwin-arm64 + main: ./cmd/celestia-appd + binary: celestia-appd + env: + - SDKPath={{ "github.com/cosmos/cosmos-sdk/version" }} + - CGO_ENABLED=1 + # CC and CXX are required for CGO to work. See + # https://github.com/goreleaser/goreleaser-cross#supported-toolchainsplatforms + - CC=oa64-clang + - CXX=oa64-clang++ + goarch: + - arm64 + goos: + - darwin + tags: + - ledger + ldflags: + # Ref: https://goreleaser.com/customization/templates/#common-fields # .Version is the version being released + # .FullCommit is git commit hash goreleaser is using for the release - -X "{{ .Env.SDKPath }}.Name=celestia-app" - -X "{{ .Env.SDKPath }}.AppName=celestia-appd" - -X "{{ .Env.SDKPath }}.Version={{ .Version }}" - -X "{{ .Env.SDKPath }}.Commit={{ .FullCommit }}" + + # - main: ./cmd/celestia-appd + # binary: celestia-appd + # env: + # - SDKPath={{ "github.com/cosmos/cosmos-sdk/version" }} + # goarch: + # - amd64 + # - arm64 + # goos: + # - darwin + # - linux + # tags: + # - ledger + # ldflags: + # # Ref: https://goreleaser.com/customization/templates/#common-fields + # # .Version is the version being released + # # .FullCommit is git commit hash goreleaser is using for the release + # - -X "{{ .Env.SDKPath }}.Name=celestia-app" + # - -X "{{ .Env.SDKPath }}.AppName=celestia-appd" + # - -X "{{ .Env.SDKPath }}.Version={{ .Version }}" + # - -X "{{ .Env.SDKPath }}.Commit={{ .FullCommit }}" dist: ./build/goreleaser archives: - format: tar.gz @@ -47,20 +87,21 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} -checksum: - name_template: "checksums.txt" -signs: - - artifacts: checksum - args: - [ - "--batch", - "-u", - "{{ .Env.GPG_FINGERPRINT }}", - "--output", - "${signature}", - "--detach-sign", - "${artifact}", - ] +# Disable checksum and signing for now +# checksum: +# name_template: "checksums.txt" +# signs: +# - artifacts: checksum +# args: +# [ +# "--batch", +# "-u", +# "{{ .Env.GPG_FINGERPRINT }}", +# "--output", +# "${signature}", +# "--detach-sign", +# "${artifact}", +# ] snapshot: name_template: "{{ incpatch .Version }}-next" changelog: diff --git a/Makefile b/Makefile index 9f66f9035d..6c41170f7d 100644 --- a/Makefile +++ b/Makefile @@ -188,3 +188,33 @@ goreleaser-build: goreleaser-release: goreleaser release --clean --fail-fast --skip-publish .PHONY: goreleaser-release + +PACKAGE_NAME := github.com/rootulp/celestia-app +GOLANG_CROSS_VERSION ?= v1.21.4 + +release-dry-run: + @docker run \ + --rm \ + -e CGO_ENABLED=1 \ + -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} \ + --clean --skip=validate --skip=publish +.PHONY: release-dry-run + +release: + @if [ ! -f ".release-env" ]; then \ + echo "\033[91m.release-env is required for release\033[0m";\ + 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} \ + release --clean +.PHONY: release