diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..4aca77ed8a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +# This workflow helps with creating releases. +# This job will only be triggered when a tag (vX.X.x) is pushed +name: Release +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: Set Env + run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV + - name: Build + uses: goreleaser/goreleaser-action@v2 + 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: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TM_VERSION: ${{ env.TM_VERSION }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000000..0ca6281cd7 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,56 @@ +--- +project_name: gaia + +env: + - GO111MODULE=on + +before: + hooks: + - go mod tidy -compat=1.17 + +builds: + - main: ./cmd/gaiad + id: "gaiad" + binary: gaiad + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + - -tags=netgo ledger + - -trimpath + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=gaia -X github.com/cosmos/cosmos-sdk/version.AppName=gaiad -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: + - darwin + - linux + - windows + goarch: + - amd64 + - arm64 + +archives: + - format: tar.gz + wrap_in_directory: "true" + format_overrides: + - goos: windows + format: zip + name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + files: + - LICENSE + - README.md + +release: + github: + owner: cosmos + name: gaia + name_template: "v{{.Version}}" + +checksum: + name_template: SHA256SUMS-v{{.Version}}.txt + algorithm: sha256 + +snapshot: + name_template: SNAPSHOT-{{ .Commit }} + +changelog: + skip: true