Skip to content

Commit e5c50b5

Browse files
ci: create a separate release workflow for zetaclient and zetacore (#4329)
* publish release actions * gorelease new files * fix security warning * fix coderabbit comments * reorganize workflow * Update .github/workflows/release-template.yml Co-authored-by: semgrep-code-zeta-chain[bot] <181804379+semgrep-code-zeta-chain[bot]@users.noreply.github.com> * Update .github/workflows/release-template.yml Co-authored-by: semgrep-code-zeta-chain[bot] <181804379+semgrep-code-zeta-chain[bot]@users.noreply.github.com> --------- Co-authored-by: semgrep-code-zeta-chain[bot] <181804379+semgrep-code-zeta-chain[bot]@users.noreply.github.com>
1 parent 1676934 commit e5c50b5

File tree

8 files changed

+419
-5
lines changed

8 files changed

+419
-5
lines changed

.github/workflows/publish-release.yml renamed to .github/workflows/publish-release-legacy.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Release
1+
name: Publish Release Legacy
22

33
on:
44
workflow_dispatch:
@@ -19,7 +19,7 @@ on:
1919
description: 'Only run pre-release checks'
2020

2121
concurrency:
22-
group: publish-release
22+
group: publish-release-legacy
2323
cancel-in-progress: false
2424

2525
jobs:
@@ -74,8 +74,10 @@ jobs:
7474
cat changelog-current.md
7575
7676
- name: Set Version
77+
env:
78+
VERSION_INPUT: ${{ inputs.version }}
7779
run: |
78-
echo "GITHUB_TAG_VERSION=${{ inputs.version }}" >> ${GITHUB_ENV}
80+
echo "GITHUB_TAG_VERSION=${VERSION_INPUT}" >> ${GITHUB_ENV}
7981
8082
- name: Create Release Tag
8183
shell: bash
@@ -133,6 +135,6 @@ jobs:
133135
run: sudo rm -rf * || echo "failed to cleanup workspace please investigate"
134136

135137
publish-typescript:
136-
needs: publish-release
138+
needs: publish-release-legacy
137139
uses: ./.github/workflows/publish-typescript.yml
138140
secrets: inherit
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish ZetaClient Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version for ZetaClient Release (e.g., v2.5.0)'
8+
required: true
9+
skip_checks:
10+
type: boolean
11+
required: false
12+
default: false
13+
description: 'Skip pre-release checks'
14+
skip_release:
15+
type: boolean
16+
required: false
17+
default: false
18+
description: 'Only run pre-release checks'
19+
20+
concurrency:
21+
group: publish-release-zetaclient
22+
cancel-in-progress: false
23+
24+
jobs:
25+
release:
26+
uses: ./.github/workflows/release-template.yml
27+
with:
28+
version: ${{ inputs.version }}
29+
skip_checks: ${{ inputs.skip_checks }}
30+
skip_release: ${{ inputs.skip_release }}
31+
component: 'zetaclient'
32+
branch_prefix: 'release/zetaclient/'
33+
make_snapshot_target: 'release-snapshot-zetaclient'
34+
make_release_target: 'release-zetaclient'
35+
attestation_paths: |
36+
dist/zetaclientd_**/*
37+
dist/zetae2e_**/*
38+
dist/checksums.txt
39+
include_typescript: false
40+
secrets: inherit
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish ZetaCore Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version for ZetaCore Release (e.g., v36.0.0)'
8+
required: true
9+
skip_checks:
10+
type: boolean
11+
required: false
12+
default: false
13+
description: 'Skip pre-release checks'
14+
skip_release:
15+
type: boolean
16+
required: false
17+
default: false
18+
description: 'Only run pre-release checks'
19+
20+
concurrency:
21+
group: publish-release-zetacore
22+
cancel-in-progress: false
23+
24+
jobs:
25+
release:
26+
uses: ./.github/workflows/release-template.yml
27+
with:
28+
version: ${{ inputs.version }}
29+
skip_checks: ${{ inputs.skip_checks }}
30+
skip_release: ${{ inputs.skip_release }}
31+
component: 'zetacore'
32+
branch_prefix: 'release/zetacore/'
33+
make_snapshot_target: 'release-snapshot-zetacore'
34+
make_release_target: 'release-zetacore'
35+
attestation_paths: |
36+
dist/zetacored_**/*
37+
dist/checksums.txt
38+
include_typescript: true
39+
secrets: inherit
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Release Template (Reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
description: 'Version for Release'
8+
required: true
9+
type: string
10+
skip_checks:
11+
type: boolean
12+
required: false
13+
default: false
14+
skip_release:
15+
type: boolean
16+
required: false
17+
default: false
18+
component:
19+
description: 'Component to release (zetacore or zetaclient)'
20+
required: true
21+
type: string
22+
branch_prefix:
23+
description: 'Expected branch prefix (e.g., release/zetacore/)'
24+
required: true
25+
type: string
26+
make_snapshot_target:
27+
description: 'Make target for snapshot (e.g., release-snapshot-zetacore)'
28+
required: true
29+
type: string
30+
make_release_target:
31+
description: 'Make target for release (e.g., release-zetacore)'
32+
required: true
33+
type: string
34+
attestation_paths:
35+
description: 'Paths for attestation (multiline string)'
36+
required: true
37+
type: string
38+
include_typescript:
39+
description: 'Whether to publish TypeScript after release'
40+
type: boolean
41+
default: false
42+
43+
jobs:
44+
log:
45+
runs-on: ubuntu-22.04
46+
steps:
47+
- name: "Log inputs"
48+
env:
49+
INPUTS: ${{ toJson(inputs) }}
50+
run: echo "${INPUTS}" | jq -r
51+
52+
check-branch:
53+
if: startsWith(github.ref, format('refs/heads/{0}', inputs.branch_prefix))
54+
runs-on: ubuntu-22.04
55+
steps:
56+
- name: Branch
57+
run: echo "${{ github.ref }}"
58+
59+
check-goreleaser:
60+
runs-on: ${{ vars.RELEASE_RUNNER }}
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Build release snapshot
64+
if: inputs.skip_checks != true
65+
env:
66+
MAKE_SNAPSHOT_TARGET: ${{ inputs.make_snapshot_target }}
67+
run: make "$MAKE_SNAPSHOT_TARGET"
68+
69+
publish-release:
70+
permissions:
71+
id-token: write
72+
contents: write
73+
attestations: write
74+
if: inputs.skip_release != true
75+
needs:
76+
- check-branch
77+
- check-goreleaser
78+
runs-on: ${{ vars.RELEASE_RUNNER }}
79+
timeout-minutes: 60
80+
environment: release
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Change Log Release Notes
85+
id: release_notes
86+
run: |
87+
awk '/^## /{flag++} flag==1{print}' changelog.md > changelog-current.md
88+
cat changelog-current.md
89+
90+
- name: Set Version
91+
env:
92+
VERSION_INPUT: ${{ inputs.version }}
93+
run: echo "GITHUB_TAG_VERSION=${VERSION_INPUT}" >> ${GITHUB_ENV}
94+
95+
- name: Create Release Tag
96+
env:
97+
TAG_VERSION: ${{ inputs.version }}
98+
shell: bash
99+
run: |
100+
if git rev-parse "${TAG_VERSION}" >/dev/null 2>&1; then
101+
echo "Error: Tag ${TAG_VERSION} already exists!"
102+
echo "If you need to re-release, either:"
103+
echo " 1. Use a new version number (recommended)"
104+
echo " 2. Manually delete the tag first with: git push --delete origin ${TAG_VERSION}"
105+
exit 1
106+
fi
107+
git tag "${TAG_VERSION}"
108+
git push --tags
109+
110+
- name: Create GitHub Release
111+
uses: softprops/action-gh-release@v2.2.0
112+
with:
113+
prerelease: true
114+
token: ${{ secrets.GITHUB_TOKEN }}
115+
body_path: changelog-current.md
116+
tag_name: ${{ env.GITHUB_TAG_VERSION }}
117+
generate_release_notes: false
118+
119+
- name: Publish Release Files
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_VERSION }}
123+
env:
124+
MAKE_RELEASE_TARGET: ${{ inputs.make_release_target }}
125+
run: |
126+
touch .release-env
127+
make "$MAKE_RELEASE_TARGET"
128+
- name: Artifact Attestations
129+
id: attestation
130+
uses: actions/attest-build-provenance@v2
131+
with:
132+
subject-path: ${{ inputs.attestation_paths }}
133+
134+
- name: Upload Attestation Bundle
135+
env:
136+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137+
TAG_VERSION: ${{ env.GITHUB_TAG_VERSION }}
138+
shell: bash
139+
run: gh release upload "${TAG_VERSION}" "${{ steps.attestation.outputs.bundle-path }}"
140+
141+
- name: Clean Up Workspace
142+
if: always()
143+
shell: bash
144+
run: sudo rm -rf * || echo "failed to cleanup workspace please investigate"
145+
146+
publish-typescript:
147+
if: inputs.include_typescript
148+
needs: publish-release
149+
uses: ./.github/workflows/publish-typescript.yml
150+
secrets: inherit

.goreleaser-zetaclient.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
env:
2+
- CGO_ENABLED=1
3+
- CC_linux_arm64=aarch64-linux-gnu-gcc
4+
- CXX_linux_arm64=aarch64-linux-gnu-g++
5+
- CC_linux_amd64=x86_64-linux-gnu-gcc
6+
- CXX_linux_amd64=x86_64-linux-gnu-g++
7+
- VERSION={{ .Version }}
8+
- BUILDTIME={{ .Date }}
9+
10+
before:
11+
hooks:
12+
- go mod download
13+
- go mod tidy
14+
15+
builds:
16+
- id: "zetaclientd"
17+
main: ./cmd/zetaclientd
18+
binary: "zetaclientd-{{ .Os }}-{{ .Arch }}"
19+
env:
20+
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
21+
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
22+
goos:
23+
- linux
24+
goarch:
25+
- arm64
26+
- amd64
27+
flags: &default_flags
28+
- -tags=pebbledb,ledger
29+
ldflags: &default_ldflags
30+
- -X github.com/cosmos/cosmos-sdk/version.Name=zetacore
31+
- -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored
32+
- -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd
33+
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
34+
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .FullCommit }}
35+
- -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb
36+
- -X github.com/zeta-chain/node/pkg/constant.Name=zetacored
37+
- -X github.com/zeta-chain/node/pkg/constant.Version={{ .Version }}
38+
- -X github.com/zeta-chain/node/pkg/constant.CommitHash={{ .FullCommit }}
39+
- -X github.com/zeta-chain/node/pkg/constant.BuildTime={{ .CommitDate }}
40+
- -X main.version={{ .Version }}
41+
- -X main.commit={{ .Commit }}
42+
- -X main.date={{ .CommitDate }}
43+
- -buildid=
44+
- -s -w
45+
46+
- id: "zetae2e"
47+
main: ./cmd/zetae2e
48+
binary: "zetae2e-{{ .Os }}-{{ .Arch }}"
49+
env:
50+
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
51+
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
52+
goos:
53+
- linux
54+
goarch:
55+
- arm64
56+
- amd64
57+
flags: *default_flags
58+
ldflags: *default_ldflags
59+
60+
archives:
61+
- format: binary
62+
name_template: "{{ .Binary }}"
63+
64+
checksum:
65+
name_template: "checksums.txt"
66+
67+
changelog:
68+
sort: asc
69+
filters:
70+
exclude:
71+
- "^docs:"
72+
- "^test:"
73+
74+
snapshot:
75+
name_template: "{{ .Tag }}-next"
76+
77+
release:
78+
draft: false
79+
target_commitish: "{{ .FullCommit }}"
80+
prerelease: auto
81+
mode: append

0 commit comments

Comments
 (0)