From 80dd33e151aedff966c593546e79ea073deca3d1 Mon Sep 17 00:00:00 2001 From: Runchao Han Date: Fri, 11 Oct 2024 16:34:53 +1100 Subject: [PATCH 1/2] init --- .github/workflows/changelog-reminder.yml | 11 +++++ .github/workflows/ci.yml | 4 -- .gitignore | 1 + .goreleaser.yml | 52 +++++++++++++++++++++ Makefile | 57 +++++++++++++++++++++++- 5 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/changelog-reminder.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/changelog-reminder.yml b/.github/workflows/changelog-reminder.yml new file mode 100644 index 00000000..ebe2a553 --- /dev/null +++ b/.github/workflows/changelog-reminder.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ccedf6b..c97e4e31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,6 @@ jobs: sudo apt-get update sudo apt-get install -y libzmq3-dev - 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 diff --git a/.gitignore b/.gitignore index 23533dad..414aecc0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ main tmp/ build/ +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..8ae6cd82 --- /dev/null +++ b/.goreleaser.yml @@ -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 diff --git a/Makefile b/Makefile index fea3c4fd..9d3c0107 100644 --- a/Makefile +++ b/Makefile @@ -78,4 +78,59 @@ proto-gen: @$(call print, "Compiling protos.") cd ./proto; ./gen_protos_docker.sh -.PHONY: proto-gen \ No newline at end of file +.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 \ No newline at end of file From 351b1d97f3424b6e73617676d51a7a3c4b0f436c Mon Sep 17 00:00:00 2001 From: Runchao Han Date: Fri, 11 Oct 2024 16:36:59 +1100 Subject: [PATCH 2/2] fix changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af09fa7..aa7fe7ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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