From 0e0aac935dedd22057f3ef70e4297c8bc08c0c20 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 | 42 ++++++++++ .goreleaser.yaml | 133 +++++++++++++++++++++++++++++++ 2 files changed, 175 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..95cfd058d7 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,42 @@ +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 Docker Buildx + uses: docker/setup-buildx-action@v2 + - + 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 --clean diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000000..fca5e42127 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,133 @@ +project_name: beacond + +env: + - CGO_ENABLED=1 + +# before: +# hooks: +# - go mod tidy +# - go mod download + +builds: + - id: beacond-darwin-amd64 + binary: beacond + main: ./app/beacond + goarch: + - amd64 + goos: + - darwin + env: + - CC=o64-clang + - CGO_LDFLAGS=-L/lib + flags: + - -mod=readonly + - -trimpath + tags: + - netgo + - ledger + - muslc + ldflags: + # -linkmode=external + - -s -w -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' + + - id: beacond-darwin-arm64 + binary: beacond + main: ./app/beacond + goarch: + - arm64 + goos: + - darwin + env: + - CC=oa64-clang + - CGO_LDFLAGS=-L/lib + flags: + - -mod=readonly + - -trimpath + tags: + - netgo + - ledger + - muslc + ldflags: + # -linkmode=external + - -s -w -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' + + - id: beacond-linux-amd64 + binary: beacond + main: ./app/beacond + env: + - CC=x86_64-linux-gnu-gcc + goarch: + - amd64 + goos: + - linux + flags: + - -mod=readonly + - -trimpath + tags: + - netgo + - ledger + - muslc + ldflags: + # -linkmode=external + - -s -w -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' + + - id: beacond-linux-arm64 + binary: beacond + main: ./app/beacond + goarch: + - arm64 + goos: + - linux + env: + - CC=aarch64-linux-gnu-gcc + flags: + - -mod=readonly + - -trimpath + tags: + - netgo + - ledger + - muslc + ldflags: + # -linkmode=external + - -s -w -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' + + +universal_binaries: + - id: beacond-darwin-universal + ids: + - beacond-darwin-amd64 + - beacond-darwin-arm64 + replace: true + name_template: "beacond" +archives: + - id: w/version + builds: + - beacond-darwin-universal + - beacond-linux-amd64 + - beacond-linux-arm64 + name_template: "beacond_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: false + format: tar.gz + files: + - none* + - id: wo/version + builds: + - beacond-darwin-universal + - beacond-linux-amd64 + - beacond-linux-arm64 + name_template: "beacond_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: false + format: tar.gz + files: + - none* + +#dflags: +# -linkmode=external +#- -s -w -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' + +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc