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

bug: Fix goreleaser config #1431

Merged
merged 6 commits into from
Jul 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
8 changes: 2 additions & 6 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Build & Publish release
- name: Build & publish release
run: |
make release
env:
GORELEASER_MOUNT_CONFIG: true
GORELEASER_IMAGE: line/goreleaserx:1.13.1-1.19.3
GORELEASER_RELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 18 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
project_name: finschia-sdk
version: 2

before:
hooks:
- go mod tidy
Expand Down Expand Up @@ -95,29 +98,31 @@ checksum:
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
use: git
use: github
format: "{{.Message}}"
sort: asc
groups:
- title: "Breaking Changes"
regexp: '^.*?BREAKING CHANGE(\([[:word:]]+\))??!?:.+$'
order: 0
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
regexp: '^.*?feat(\([^)]*\))?!?:.+$'
order: 1
- title: 'Bug Fixes'
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
regexp: '^.*?fix(\([^)]*\))?!?:.+$'
order: 2
- title: 'Build, CI'
regexp: '^.*?(ci|build)(\([[:word:]]+\))??!?:.+$'
regexp: '^.*?(ci|build)(\([^)]*\))?!?:.+$'
order: 3
- title: 'Document Updates'
regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$'
order: 4
- title: Improvements
regexp: '^.*?(test|refactor|perf)(\([[:word:]]+\))??!?:.+$'
regexp: '^.*?(test|refactor|perf)(\([^)]*\))?!?:.+$'
order: 4
- title: 'Document Updates'
regexp: '^.*?docs(\([^)]*\))?!?:.+$'
order: 5
- title: Others
order: 999
regexp: '^.*?(chore|style|revert)(\([^)]*\))?!?:.+$'
order: 6

release:
github:
Expand All @@ -126,7 +131,10 @@ release:
prerelease: auto
mode: replace
draft: false

header: |
# Release {{ .Version }} ({{ .Date }})
footer: |
**Full Changelog**: https://github.com/Finschia/finschia-sdk/compare/{{ .PreviousTag }}...{{ .CurrentTag }}
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/fswap) [\#1385](https://github.com/Finschia/finschia-sdk/pull/1385) add accidentally deleted event emissions(EventSetSwap, EventAddDenomMetadata)
* (x/fswap) [\#1392](https://github.com/Finschia/finschia-sdk/pull/1392) fix dummy denom coin data for test in fswap
* (style) [\#1414](https://github.com/Finschia/finschia-sdk/pull/1414) improve code quality with new linters
* (ci) [\#1431](https://github.com/Finschia/finschia-sdk/pull/1431) Fix goreleaser config and replace deprecated docker image with official one

### Removed

Expand Down
81 changes: 39 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
CGO_ENABLED ?= 1
ARCH ?= x86_64
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)

export GO111MODULE = on

Expand Down Expand Up @@ -91,6 +92,7 @@ ldflags = -X github.com/Finschia/finschia-sdk/version.Name=sim \
-X github.com/Finschia/finschia-sdk/types.DBBackend=$(DB_BACKEND) \
-X "github.com/Finschia/finschia-sdk/version.BuildTags=$(build_tags_comma_sep)"


ifeq (,$(findstring nostrip,$(LBM_BUILD_OPTIONS)))
ldflags += -w -s
endif
Expand Down Expand Up @@ -526,62 +528,57 @@ error-doc-gen:
.PHONY: error-doc-gen

###############################################################################
### release ###
### Release ###
###############################################################################

GORELEASER_CONFIG ?= .goreleaser.yml

GORELEASER_BUILD_LDF = $(ldflags)
GORELEASER_BUILD_LDF := $(strip $(GORELEASER_BUILD_LDF))
GORELEASER_IMAGE := goreleaser/goreleaser-cross:v$(GO_VERSION)
PACKAGE_NAME := $(shell grep "^module" go.mod | cut -d' ' -f2)

GORELEASER_SKIP_VALIDATE ?= false
GORELEASER_DEBUG ?= false
GORELEASER_IMAGE ?= line/goreleaserx:1.13.1-1.19.3
GORELEASER_RELEASE ?= false
GO_MOD_NAME := github.com/Finschia/finschia-sdk

ifeq ($(GORELEASER_RELEASE),true)
GORELEASER_SKIP_VALIDATE := false
GORELEASER_SKIP_PUBLISH := release --skip-publish=false
ifdef GITHUB_TOKEN
release:
docker run --rm \
-e BUILD_TAGS="$(build_tags)" \
-e BUILD_VARS='$(ldflags)' \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
--platform linux/amd64 \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
$(GORELEASER_IMAGE) \
release \
--clean \
--skip=announce
else
GORELEASER_SKIP_PUBLISH := --skip-publish=true
GORELEASER_SKIP_VALIDATE ?= false
GITHUB_TOKEN=
endif

ifeq ($(GORELEASER_MOUNT_CONFIG),true)
GORELEASER_IMAGE := -v $(HOME)/.docker/config.json:/root/.docker/config.json $(GORELEASER_IMAGE)
release:
@echo "Error: GITHUB_TOKEN is not defined. Please define it before running 'make release'."
endif

release-snapshot:
release-dry-run:
docker run --rm \
-e BUILD_TAGS="$(build_tags)" \
-e BUILD_VARS='$(GORELEASER_BUILD_LDF)' \
-e BUILD_VARS='$(ldflags)' \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(shell pwd):/go/src/$(GO_MOD_NAME) \
-w /go/src/$(GO_MOD_NAME) \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
$(GORELEASER_IMAGE) \
build --snapshot \
-f "$(GORELEASER_CONFIG)" \
--skip-validate=$(GORELEASER_SKIP_VALIDATE) \
--debug=$(GORELEASER_DEBUG) \
--rm-dist
release \
--clean \
--skip=publish --skip=announce --skip=validate \
--verbose

release:
release-snapshot:
docker run --rm \
-e BUILD_TAGS="$(build_tags)" \
-e BUILD_VARS='$(GORELEASER_BUILD_LDF)' \
-e BUILD_VARS='$(ldflags)' \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(shell pwd):/go/src/$(GO_MOD_NAME) \
-w /go/src/$(GO_MOD_NAME) \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
$(GORELEASER_IMAGE) \
$(GORELEASER_SKIP_PUBLISH) \
-f "$(GORELEASER_CONFIG)" \
--skip-validate=$(GORELEASER_SKIP_VALIDATE) \
--skip-announce=true \
--debug=$(GORELEASER_DEBUG) \
--rm-dist

.PHONY: release-snapshot release
release \
--clean \
--snapshot

.PHONY: release release-dry-run release-snapshot
Loading