Skip to content

Commit

Permalink
chore: improve release
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed May 28, 2024
1 parent 63ff346 commit 31c0c67
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 143 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@ name: Release
on:
push:
tags:
- "v*.*.*"
- "v[0-9]+\\.[0-9]+\\.[0-9]+"
- "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+"

jobs:
goreleaser:
release:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: set tag env
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: generate release note
run: ./contrib/scripts/release-note.sh ${{ env.VERSION }}
- name: setup release environment
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Setup release environment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: release publish
run: echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: Release publish
run: make release
90 changes: 54 additions & 36 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
before:
hooks:
- go mod download

builds:
- id: "fxcore-darwin"
main: ./cmd/fxcored
binary: bin/fxcored
binary: fxcored
env:
- CGO_ENABLED=1
- CC=o64-clang
Expand All @@ -16,11 +12,12 @@ builds:
- amd64
flags:
- -tags=cgo netgo ledger
- -trimpath
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version={{.Summary}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.FullCommit}} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- id: "fxcore-darwin-arm64"
main: ./cmd/fxcored
binary: bin/fxcored
binary: fxcored
env:
- CGO_ENABLED=1
- CC=oa64-clang
Expand All @@ -31,11 +28,12 @@ builds:
- arm64
flags:
- -tags=cgo netgo ledger
- -trimpath
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version={{.Summary}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.FullCommit}} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- id: "fxcore-linux"
main: ./cmd/fxcored
binary: bin/fxcored
binary: fxcored
env:
- CGO_ENABLED=1
- CC=gcc
Expand All @@ -46,11 +44,12 @@ builds:
- amd64
flags:
- -tags=cgo netgo ledger
- -trimpath
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version={{.Summary}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.FullCommit}} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- id: "fxcore-linux-arm64"
main: ./cmd/fxcored
binary: bin/fxcored
binary: fxcored
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
Expand All @@ -61,11 +60,12 @@ builds:
- arm64
flags:
- -tags=cgo netgo ledger
- -trimpath
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version={{.Summary}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.FullCommit}} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- id: "fxcore-windows"
main: ./cmd/fxcored
binary: bin/fxcored
binary: fxcored
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
Expand All @@ -76,29 +76,21 @@ builds:
- amd64
flags:
- -tags=cgo netgo ledger
- -trimpath
- -buildmode=exe
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version={{.Summary}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.FullCommit}} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=fxcore -X github.com/cosmos/cosmos-sdk/version.AppName=fxcored -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger

archives:
- name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip
builds:
- fxcore-darwin
- fxcore-darwin-arm64
- fxcore-windows
- fxcore-linux
- fxcore-linux-arm64
- format: binary
name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"

checksum:
name_template: 'checksums.txt'
name_template: SHA256SUMS-v{{.Version}}.txt
algorithm: sha256

snapshot:
name_template: SNAPSHOT-{{ .Tag }}

release:
draft: true
Expand All @@ -108,9 +100,35 @@ release:
header: |
# fxCore {{ .Tag }} Release Notes
footer: |
## Docker Images
* fxcore: `ghcr.io/functionx/fx-core:{{ .Version }}`
* cosmovisor: `ghcr.io/functionx/fxcorevisor:{{ .Version }}`
snapshot:
name_template: "{{ .Tag }}"
<!-- Add upgrade instructions here -->
## 📝 Changelog
**Full Changelog**: https://github.com/functionx/fx-core/compare/{{ .PreviousTag }}...{{ .Tag }}
## 🚀 Highlights
<!-- Add any highlights of this release -->
## 🔨 Build from source
```bash
git clone https://github.com/functionx/fx-core.git
cd fx-core && git checkout {{ .Tag }}
make install
```
## 🐳 Docker Images
```bash
docker pull ghcr.io/functionx/fx-core:{{ .Version }}
```
```bash
docker pull ghcr.io/functionx/fxcorevisor:{{ .Version }}
```
## ⚡️ Download binaries
Binaries for linux, darwin, and windows are available below.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ contract-publish:
### Releasing ###
###############################################################################

PACKAGE_NAME := github.com/functionx/fx-core/v7
PACKAGE_NAME := $(shell go list -m)
GOLANG_CROSS_VERSION := v1.21
release-dry-run:
docker run --rm --privileged -e CGO_ENABLED=1 \
Expand All @@ -266,7 +266,7 @@ release-dry-run:
-v ${GOPATH}/pkg:/go/pkg \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --skip-publish --snapshot
release --clean --skip=validate --skip=publish --snapshot

release:
@if [ ! -f ".release-env" ]; then \
Expand All @@ -278,6 +278,6 @@ release:
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --skip-validate --release-notes ./release-note.md
release --clean --skip=validate

.PHONY: release-dry-run release
22 changes: 0 additions & 22 deletions contrib/githooks/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions contrib/githooks/precommit

This file was deleted.

31 changes: 0 additions & 31 deletions contrib/scripts/release-note.sh

This file was deleted.

0 comments on commit 31c0c67

Please sign in to comment.