Skip to content

Commit

Permalink
ci: setup cosmovisor goreleaser workflow (cosmos#10110)
Browse files Browse the repository at this point in the history
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: cosmos#10109

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
allthatjazzleo authored Oct 4, 2021
1 parent dcf67d7 commit b601f52
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/cosmovisor-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release Cosmovisor

on:
push:
tags:
- "cosmovisor/v*.*.*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/[email protected]
with:
go-version: 1.17
# get 'v*.*.*' part from 'cosmovisor/v*.*.*' and save to $GITHUB_ENV
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/cosmovisor/}" >> $GITHUB_ENV
# remove the possible pre-existing same tag for cosmos-sdk related tags instead of cosmovisor tags
# Because goreleaser enforces semantic versioning and will error on non compliant tags.(https://goreleaser.com/limitations/semver/)
- name: Tag without prefix locally to avoid error in goreleaser
run: |-
git tag -d ${{ env.RELEASE_VERSION }} || echo "No such a tag exists before"
git tag ${{ env.RELEASE_VERSION }} HEAD
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --skip-validate
workdir: cosmovisor
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: cosmovisor/${{ env.RELEASE_VERSION }}
40 changes: 40 additions & 0 deletions cosmovisor/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
project_name: cosmovisor

release:
disable: false
name_template: "{{.Tag}}"

before:
hooks:
- go mod tidy

builds:
- main: ./cmd/cosmovisor
ldflags:
- -X 'github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor/cmd.Version={{ replace .Version "cosmovisor/" "" }}'
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0

archives:
- name_template: '{{ replace .Version "cosmovisor/" "cosmovisor-" }}-{{ .Os }}-{{ .Arch }}'
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'SHA256SUMS-{{ replace .Version "cosmovisor/" "cosmovisor-" }}.txt'
algorithm: sha256
changelog:
skip: true
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

0 comments on commit b601f52

Please sign in to comment.