ci: update goreleaser (#604)

* ci: update goreleaser

* bump version
This commit is contained in:
Federico Kunze Küllmer 2021-09-29 15:58:39 +02:00 committed by GitHub
parent 1894d22609
commit aeb7e1589e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 145 deletions

View File

@ -1,27 +1,38 @@
name: goreleaser # This workflow helps with creating releases.
# This job will only be triggered when a tag (vX.X.x) is pushed
name: Release
on: on:
push: push:
# Sequence of patterns matched against refs/tags
tags: tags:
- "v*.*.*" - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs: jobs:
goreleaser: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: release
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true fetch-depth: 0
- name: Set up Go - uses: actions/setup-go@v2.1.4
uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: 1.17
- name: release dry run - name: Set Env
run: make release-dry-run run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV
- name: setup release environment - name: Build
uses: goreleaser/goreleaser-action@v2.7.0
if: ${{ github.event_name == 'pull_request' }}
with:
version: latest
args: build --rm-dist --skip-validate # skip validate skips initial sanity checks in order to be able to fully run
env:
TM_VERSION: ${{ env.TM_VERSION }}
- name: Release
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist --release-notes ./RELEASE_NOTES.md
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |- TM_VERSION: ${{ env.TM_VERSION }}
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: release publish
run: make release

View File

@ -1,109 +1,56 @@
---
project_name: ethermint
env:
- GO111MODULE=on
before: before:
hooks: hooks:
- go mod download - go mod tidy
builds: builds:
- id: "ethermintd-darwin" - main: ./cmd/ethermintd
main: ./cmd/ethermintd id: "ethermintd"
binary: bin/ethermintd binary: ethermintd
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -tags=netgo ledger
- -trimpath
env: env:
- CGO_ENABLED=1 - CGO_ENABLED=0
- CC=o64-clang ldflags:
- CXX=o64-clang++ - -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -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 -X github.com/tendermint/tendermint/version.TMCoreSemVer={{ .Env.TM_VERSION }}
goos: goos:
- darwin - darwin
goarch:
- amd64
flags:
- -tags=cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "ethermintd-darwin-arm64"
main: ./cmd/ethermintd
binary: bin/ethermintd
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
goos:
- darwin
goarch:
- arm64
flags:
- -tags=cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "ethermintd-linux"
main: ./cmd/ethermintd
binary: bin/ethermintd
env:
- CGO_ENABLED=1
- CC=gcc
- CXX=g++
goos:
- linux - linux
goarch: goarch:
- amd64 - amd64
flags: - arm
- -tags=cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "ethermintd-linux-arm64"
main: ./cmd/ethermintd
binary: bin/ethermintd
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
goos:
- linux
goarch:
- arm64 - arm64
flags:
- -tags=cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "ethermintd-windows"
main: ./cmd/ethermintd
binary: bin/ethermintd
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goos:
- windows
goarch:
- amd64
flags:
- -tags=cgo
- -buildmode=exe
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=ethermint -X github.com/cosmos/cosmos-sdk/version.AppName=ethermintd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
archives: archives:
- name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' - format: tar.gz
replacements: wrap_in_directory: true
darwin: Darwin format_overrides:
linux: Linux - goos: windows
windows: Windows format: zip
amd64: x86_64 name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format_overrides: files:
- goos: windows - LICENSE
format: zip - README.md
builds:
- ethermintd-darwin release:
- ethermintd-darwin-arm64 github:
- ethermintd-windows owner: tharsis
- ethermintd-linux name: ethermint
- ethermintd-linux-arm64 name_template: "v{{.Version}}"
checksum: checksum:
name_template: 'checksums.txt' name_template: SHA256SUMS-v{{.Version}}.txt
changelog: algorithm: sha256
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
snapshot: snapshot:
name_template: "{{ .Tag }}-next" name_template: SNAPSHOT-{{ .Commit }}
changelog:
skip: true

View File

@ -498,39 +498,3 @@ localnet-show-logstream:
docker-compose logs --tail=1000 -f docker-compose logs --tail=1000 -f
.PHONY: build-docker-local-ethermint localnet-start localnet-stop .PHONY: build-docker-local-ethermint localnet-start localnet-stop
###############################################################################
### Releasing ###
###############################################################################
PACKAGE_NAME:=github.com/tharsis/ethermint
GOLANG_CROSS_VERSION = v1.17
release-dry-run:
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v ${GOPATH}/pkg:/go/pkg \
-w /go/src/$(PACKAGE_NAME) \
troian/golang-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate --skip-publish
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-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) \
troian/golang-cross:${GOLANG_CROSS_VERSION} \
release --rm-dist --skip-validate
.PHONY: release-dry-run release