-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add goreleaser, cleanup release process #2549
Changes from 5 commits
0cbcb92
fea07a4
c6d2805
1a74879
251a92d
6fbb7ff
9ff6964
8db2089
0c61288
2308abb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,33 @@ | ||
name: create release | ||
name: "Release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+\\.[0-9]+\\.[0-9]+" | ||
- "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" | ||
# can be used to re-release an existing tag | ||
workflow_dispatch: | ||
|
||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about rc ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted |
||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3.5.2 | ||
- name: set tag env | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: install go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.x | ||
check-latest: true | ||
- name: Build Artifacts | ||
run: make distclean build-reproducible | ||
- name: generate release note | ||
run: go run ./contrib/generate_release_note/main.go ${{ env.VERSION }} ./artifacts/build_report ./CHANGELOG.md | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body_path: ./releasenote | ||
draft: true | ||
prerelease: false | ||
- name: Upload build_report | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/build_report | ||
asset_name: build_report | ||
asset_content_type: application/file | ||
- name: Upload darwin-amd64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}-darwin-amd64 | ||
asset_name: gaiad-${{ env.VERSION }}-darwin-amd64 | ||
asset_content_type: application/binary | ||
- name: Upload darwin-arm64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}-darwin-arm64 | ||
asset_name: gaiad-${{ env.VERSION }}-darwin-arm64 | ||
asset_content_type: application/binary | ||
- name: Upload linux-amd64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}-linux-amd64 | ||
asset_name: gaiad-${{ env.VERSION }}-linux-amd64 | ||
asset_content_type: application/binary | ||
- name: Upload linux-arm64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}-linux-arm64 | ||
asset_name: gaiad-${{ env.VERSION }}-linux-arm64 | ||
asset_content_type: application/binary | ||
- name: Upload windows-amd64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}-windows-amd64.exe | ||
asset_name: gaiad-${{ env.VERSION }}-windows-amd64.exe | ||
asset_content_type: application/binary | ||
- name: Upload compression | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/gaiad-${{ env.VERSION }}.tar.gz | ||
asset_name: gaiad-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_content_type: application/gzip | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Set Env | ||
run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV | ||
|
||
- name: Release | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: latest | ||
args: release --clean --release-notes ./RELEASE_NOTES.md | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,6 @@ project_name: gaia | |
env: | ||
- GO111MODULE=on | ||
|
||
before: | ||
hooks: | ||
- go mod tidy -compat=1.20 | ||
|
||
builds: | ||
- main: ./cmd/gaiad | ||
id: "gaiad" | ||
|
@@ -19,6 +15,7 @@ builds: | |
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
# .Env.TM_VERSION is provided in the workflow runner environment -> see .github/workflows/release.yml | ||
- -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 | ||
|
@@ -29,20 +26,23 @@ builds: | |
- arm64 | ||
|
||
archives: | ||
- format: tar.gz | ||
wrap_in_directory: "true" | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
# disables archiving; to enable use commented lines below | ||
- format: binary | ||
name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
# - format: tar.gz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave it it so we don't need to spend hours figuring out how to have gzipped release binaries in case they are needed |
||
# 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 | ||
# rlcp: true | ||
|
||
release: | ||
github: | ||
owner: cosmos | ||
name: gaia | ||
prerelease: true | ||
name_template: "v{{.Version}}" | ||
|
||
checksum: | ||
|
@@ -53,4 +53,4 @@ snapshot: | |
name_template: SNAPSHOT-{{ .Commit }} | ||
|
||
changelog: | ||
skip: true | ||
skip: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,17 +117,6 @@ vulncheck: $(BUILDDIR)/ | |
GOBIN=$(BUILDDIR) go install golang.org/x/vuln/cmd/govulncheck@latest | ||
$(BUILDDIR)/govulncheck ./... | ||
|
||
build-reproducible: go.sum | ||
$(DOCKER) rm latest-build || true | ||
$(DOCKER) run --volume=$(CURDIR):/sources:ro \ | ||
--env TARGET_PLATFORMS='linux/amd64 darwin/amd64 linux/arm64 darwin/arm64 windows/amd64' \ | ||
--env APP=gaiad \ | ||
--env VERSION=$(VERSION) \ | ||
--env COMMIT=$(COMMIT) \ | ||
--env LEDGER_ENABLED=$(LEDGER_ENABLED) \ | ||
--name latest-build majita/rbuilder:latest | ||
$(DOCKER) cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/ | ||
|
||
build-linux: go.sum | ||
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build | ||
|
||
|
@@ -150,6 +139,39 @@ clean: | |
distclean: clean | ||
rm -rf vendor/ | ||
|
||
############################################################################### | ||
### Release ### | ||
############################################################################### | ||
|
||
# create tag and run goreleaser without publishing | ||
create-release-dry-run: | ||
ifneq ($(strip $(TAG)),) | ||
@echo "--> Dry running release for tag: $(TAG)" | ||
@echo "--> Create tag: $(TAG) dry run" | ||
git tag -s $(TAG) -m $(TAG) | ||
git push --tags --dry-run | ||
@echo "--> Delete local tag: $(TAG)" | ||
@git tag -d $(TAG) | ||
@echo "--> Running goreleaser" | ||
TM_VERSION=$(TM_VERSION) goreleaser release --snapshot --clean | ||
mpoke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@rm -rf dist/ | ||
@echo "--> Done create-release-dry-run for tag: $(TAG)" | ||
else | ||
@echo "--> No tag specified, skipping tag release" | ||
endif | ||
|
||
# create tag and publish it | ||
create-release: | ||
MSalopek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ifneq ($(strip $(TAG)),) | ||
@echo "--> Running release for tag: $(TAG)" | ||
@echo "--> Create release tag: $(TAG)" | ||
git tag -s $(TAG) -m $(TAG) | ||
git push --tags | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should push a specific tag, last time doing release, i found i have some local tags of rc, which seem are deleted in remote ? if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thank you! Changed to: |
||
@echo "--> Done creating release tag: $(TAG)" | ||
else | ||
@echo "--> No tag specified, skipping create-release" | ||
endif | ||
|
||
############################################################################### | ||
### Devdoc ### | ||
############################################################################### | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
A release notes template that should be adapted for every release | ||
- release: <v*.*.*> | ||
- release branch: <v*.x> | ||
- the last release: <v-last> | ||
- the last release branch: <v-last.x> | ||
--> | ||
|
||
# Gaia <v*.*.*> Release Notes | ||
|
||
## 📝 Changelog | ||
|
||
Check out the [changelog](https://github.com/cosmos/gaia/blob/<v*.*.*>/CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/cosmos-sdk/compare/release/<v-last>...<v*.*.*>) from last release. | ||
|
||
<!-- Add the following line for major releases --> | ||
Refer to the [upgrading guide](https://github.com/cosmos/cosmos-sdk/blob/release/<v*.x>/UPGRADING.md) when migrating from `<v-last.x>` to `<v*.x>`. | ||
|
||
## 🚀 Highlights | ||
|
||
<!-- Add any highlights of this release --> | ||
|
||
## 🔨 Build from source | ||
|
||
```bash | ||
git clone https://github.com/cosmos/gaia | ||
cd gaia && git checkout <v*.*.*> | ||
make install | ||
``` | ||
|
||
## ⚡️ Download binaries | ||
|
||
Binaries for linux, darwin, and windows are available below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this limit the version numbers to 0 through 9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted