From 98c6f8e1af529d9f18886e66f1a9ca8d770e2e48 Mon Sep 17 00:00:00 2001 From: Chuck Bear Date: Fri, 2 Feb 2024 17:55:11 -0500 Subject: [PATCH] build(ci): Add goreleaser to ship binaries --- .github/workflows/goreleaser.yml | 39 ++++++++++++++++++++++++ .goreleaser.yaml | 52 ++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000000..f85b6ab057 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,39 @@ +name: goreleaser + +on: + push: + # run only against tags + #tags: + # - '*' + branches: + - '*' + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Fetch all tags + run: git fetch --force --tags + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.21 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + distribution: goreleaser + version: latest + args: release --rm-dist diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000000..591c0a6efa --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,52 @@ +project_name: beacond + +before: + hooks: + - go mod tidy + - go mod download + +builds: + - <<: &build_defaults + # Custom flags templates. + flags: + - -trimpath + tags: + - netgo + - ledger + - muslc + ldflags: + - -s -w -linkmode=external -extldflags '-Wl,-z,muldefs -static' -X github.com/cosmos/cosmos-sdk/version.Name=beacond -X github.com/cosmos/cosmos-sdk/version.AppName=beacond -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags='netgo,ledger,muslc -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb' + env: + - CGO_ENABLED=0 + - GOPRIVATE="github.com/berachain" + goos: [ darwin, linux, windows ] + goarch: [amd64, arm64] # add arm64 and 386 arch if necessary + id: beacond + binary: beacond + main: ./cmd/beacond + +archives: + - <<: &archive_defaults + format: tar.gz + format_overrides: + - goos: windows + format: zip + id: beacond + builds: [ beacond ] + name_template: "beacond_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - Merge pull request + - Merge branch + - go mod tidy \ No newline at end of file