diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 6e9feb7be7..228fd75bfc 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -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 }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 5ee34e76f1..e2b66ecf4c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,6 @@ +project_name: finschia-sdk +version: 2 + before: hooks: - go mod tidy @@ -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: @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index e638d0a0ec..5a67eb1762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Makefile b/Makefile index f42e8e834b..c32a0279cc 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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