Skip to content
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

ci: add goreleaser setup and move out changelog reminder #170

Merged
merged 7 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/changelog-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Changelog Reminder
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main

jobs:
changelog_reminder:
uses: babylonlabs-io/.github/.github/workflows/reusable_changelog_reminder.yml@v0.7.0
secrets: inherit
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ jobs:
run-integration-tests: false
run-lint: true

changelog_reminder:
uses: babylonlabs-io/.github/.github/workflows/reusable_changelog_reminder.yml@v0.7.0
secrets: inherit

docker_pipeline:
uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.7.0
secrets: inherit
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,5 @@ docs/diagrams/plantuml.jar
.testnets/
.testnet/
mytestnet/
output/
output/
dist/
62 changes: 62 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
project_name: babylon

builds:
- id: babylond-linux-amd64
main: ./cmd/babylond/main.go
binary: babylond
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm.x86_64.so -O /lib/libwasmvm_muslc.x86_64.so
goos:
- linux
goarch:
- amd64
env:
- GO111MODULE=on
flags:
- -mod=readonly
- -trimpath
ldflags:
- -X github.com/cosmos/cosmos-sdk/version.Name=babylon
- -X github.com/cosmos/cosmos-sdk/version.AppName=babylond
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
Comment on lines +22 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 💯

- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo
- -w -s
- -linkmode=external
tags:
- netgo
- ledger
- muslc
- osusergo

archives:
- id: zipped
builds:
- babylond-linux-amd64
name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: tar.gz
files:
- none*
- id: binaries
builds:
- babylond-linux-amd64
name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: binary
files:
- none*

checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
algorithm: sha256

release:
github:
owner: babylonlabs-io
name: babylon

# Docs: https://goreleaser.com/customization/changelog/
changelog:
disable: true

dist: dist
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Misc Improvements

* [#170](https://github.com/babylonlabs-io/babylon/pull/170) Go releaser setup
* [#168](https://github.com/babylonlabs-io/babylon/pull/168) Remove devdoc from
Makefile and remove unnecessary gin replace.

Expand Down
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,57 @@ diagrams: ## Generate diagrams for documentation
update-changelog: ## Update the project changelog
@echo ./scripts/update_changelog.sh $(since_tag) $(upcoming_tag)
./scripts/update_changelog.sh $(since_tag) $(upcoming_tag)

###############################################################################
### Release ###
###############################################################################

# The below is adapted from https://github.com/osmosis-labs/osmosis/blob/main/Makefile
GO_VERSION := $(shell grep -E '^go [0-9]+\.[0-9]+' go.mod | awk '{print $$2}')
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION)
COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //')

.PHONY: release-dry-run release-snapshot release
release-dry-run:
docker run \
--rm \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/babylon \
-w /go/src/babylon \
$(GORELEASER_IMAGE) \
release \
--clean \
--skip=publish

release-snapshot:
docker run \
--rm \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/babylon \
-w /go/src/babylon \
$(GORELEASER_IMAGE) \
release \
--clean \
--snapshot \
--skip=publish,validate

# NOTE: By default, the CI will handle the release process.
# this is for manually releasing.
ifdef GITHUB_TOKEN
release:
docker run \
--rm \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/babylon \
-w /go/src/babylon \
$(GORELEASER_IMAGE) \
release \
--clean
else
release:
@echo "Error: GITHUB_TOKEN is not defined. Please define it before running 'make release'."
endif
4 changes: 4 additions & 0 deletions RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ git pull --tags
git tag -s -a v0.10.0-rc.0 -m "Version v0.10.0-rc.0"
```
With every tag, the Github action will use the `goreleaser` tool to create a
release, including artifacts and their checksums.
## Patch Release Procedure
A _patch release_ is an increment of the patch number (eg: `v10.0.0` → `v10.0.1`).
Expand Down
Loading