Skip to content

Commit

Permalink
ci: add goreleaser setup and move out changelog reminder (#76)
Browse files Browse the repository at this point in the history
This PR

- sets up Go releaser for Babylon. Currently it only supports linux
amd64. Other targets will be supported in the future. To test locally,
run `make release-snapshot`
- moves changelog reminder out from the CI flow
  • Loading branch information
SebastianElvis authored Oct 11, 2024
1 parent 005d902 commit 4ccc7e5
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 5 deletions.
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/[email protected]
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:
sudo apt-get update
sudo apt-get install -y libzmq3-dev
changelog_reminder:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit

docker_pipeline:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
main
tmp/
build/
dist/
52 changes: 52 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
project_name: vigilante

builds:
- id: vigilante-linux-amd64
main: ./cmd/vigilante/main.go
binary: vigilante
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm_muslc.x86_64.a -O /usr/lib/libwasmvm_muslc.x86_64.a
goos:
- linux
goarch:
- amd64
env:
- GO111MODULE=on
flags:
- -mod=readonly
- -trimpath
tags:
- netgo
- osusergo

archives:
- id: zipped
builds:
- vigilante-linux-amd64
name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: tar.gz
files:
- none*
- id: binaries
builds:
- vigilante-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: vigilante

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

dist: dist
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Improvements

* [#76](https://github.com/babylonlabs-io/vigilante/pull/76) add goreleaser
setup and move out changelog reminder
57 changes: 56 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,59 @@ proto-gen:
@$(call print, "Compiling protos.")
cd ./proto; ./gen_protos_docker.sh

.PHONY: proto-gen
.PHONY: proto-gen


###############################################################################
### 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 grep github.com/CosmWasm/wasmvm go.mod | cut -d' ' -f2)

.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

0 comments on commit 4ccc7e5

Please sign in to comment.