Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
134 changes: 134 additions & 0 deletions .github/workflows/publish-release-zetaclient.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Publish ZetaClient Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version for ZetaClient Release (e.g., v2.5.0)'
required: true
skip_checks:
type: boolean
required: false
default: false
description: 'Skip pre-release checks'
skip_release:
type: boolean
required: false
default: false
description: 'Only run pre-release checks'

concurrency:
group: publish-release-zetaclient
cancel-in-progress: false

jobs:
log:
runs-on: ubuntu-22.04
steps:
- name: "Log inputs"
env:
INPUTS: ${{ toJson(inputs) }}
run: echo "${INPUTS}" | jq -r

check-branch:
if: startsWith(github.ref, 'refs/heads/release/zetaclient/')
runs-on: ubuntu-22.04
steps:
- name: Branch
run: |
echo "${{ github.ref }}"

check-goreleaser:
runs-on: ${{ vars.RELEASE_RUNNER }}
steps:
- uses: actions/checkout@v4
- name: Build release snapshot
if: inputs.skip_checks != true
run: |
make release-snapshot-zetaclient

publish-release:
permissions:
id-token: write
contents: write
attestations: write
if: inputs.skip_release != true
needs:
- check-branch
- check-goreleaser
runs-on: ${{ vars.RELEASE_RUNNER }}
timeout-minutes: 60
environment: release
steps:
- uses: actions/checkout@v4

- name: Change Log Release Notes
id: release_notes
run: |
awk '/^## /{flag++} flag==1{print}' changelog.md > changelog-current.md
cat changelog-current.md

- name: Set Version
env:
VERSION_INPUT: ${{ inputs.version }}
run: |
echo "GITHUB_TAG_VERSION=${VERSION_INPUT}" >> ${GITHUB_ENV}

- name: Create Release Tag
shell: bash
run: |
git tag ${GITHUB_TAG_VERSION}
create_tag=$(git push --tags || echo "tag exists")
if [[ $create_tag == "tag exists" ]]; then
echo "Delete existing tag to re-create"
git tag -d ${GITHUB_TAG_VERSION}
git push --delete origin ${GITHUB_TAG_VERSION}
echo "sleep for 5 seconds to let github catch up."
sleep 5
echo "Re-Create Tag."
git tag ${GITHUB_TAG_VERSION}
git push --tags
fi

- name: Create GitHub Release
uses: softprops/action-gh-release@v2.2.0
with:
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
body_path: changelog-current.md
tag_name: ${{ env.GITHUB_TAG_VERSION }}
generate_release_notes: false

- name: Publish ZetaClient Release Files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_VERSION }}
run: |
touch .release-env
make release-zetaclient

- name: Artifact Attestations
id: attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: |
dist/zetaclientd_**/*
dist/zetae2e_**/*
dist/checksums.txt

- name: Upload Attestation Bundle
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload ${{ env.GITHUB_TAG_VERSION }} ${{ steps.attestation.outputs.bundle-path }}

- name: Clean Up Workspace
if: always()
shell: bash
run: sudo rm -rf * || echo "failed to cleanup workspace please investigate"

publish-typescript:
needs: publish-release
uses: ./.github/workflows/publish-typescript.yml
secrets: inherit
128 changes: 128 additions & 0 deletions .github/workflows/publish-release-zetacore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Publish ZetaCore Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version for ZetaCore Release (e.g., v36.0.0)'
required: true
skip_checks:
type: boolean
required: false
default: false
description: 'Skip pre-release checks'
skip_release:
type: boolean
required: false
default: false
description: 'Only run pre-release checks'

concurrency:
group: publish-release-zetacore
cancel-in-progress: false

jobs:
log:
runs-on: ubuntu-22.04
steps:
- name: "Log inputs"
env:
INPUTS: ${{ toJson(inputs) }}
run: echo "${INPUTS}" | jq -r

check-branch:
if: startsWith(github.ref, 'refs/heads/release/zetacore/')
runs-on: ubuntu-22.04
steps:
- name: Branch
run: |
echo "${{ github.ref }}"

check-goreleaser:
runs-on: ${{ vars.RELEASE_RUNNER }}
steps:
- uses: actions/checkout@v4
- name: Build release snapshot
if: inputs.skip_checks != true
run: |
make release-snapshot-zetacore

publish-release:
permissions:
id-token: write
contents: write
attestations: write
if: inputs.skip_release != true
needs:
- check-branch
- check-goreleaser
runs-on: ${{ vars.RELEASE_RUNNER }}
timeout-minutes: 60
environment: release
steps:
- uses: actions/checkout@v4

- name: Change Log Release Notes
id: release_notes
run: |
awk '/^## /{flag++} flag==1{print}' changelog.md > changelog-current.md
cat changelog-current.md

- name: Set Version
env:
VERSION_INPUT: ${{ inputs.version }}
run: |
echo "GITHUB_TAG_VERSION=${VERSION_INPUT}" >> ${GITHUB_ENV}

- name: Create Release Tag
shell: bash
run: |
git tag ${GITHUB_TAG_VERSION}
create_tag=$(git push --tags || echo "tag exists")
if [[ $create_tag == "tag exists" ]]; then
echo "Delete existing tag to re-create"
git tag -d ${GITHUB_TAG_VERSION}
git push --delete origin ${GITHUB_TAG_VERSION}
echo "sleep for 5 seconds to let github catch up."
sleep 5
echo "Re-Create Tag."
git tag ${GITHUB_TAG_VERSION}
git push --tags
fi

- name: Create GitHub Release
uses: softprops/action-gh-release@v2.2.0
with:
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
body_path: changelog-current.md
tag_name: ${{ env.GITHUB_TAG_VERSION }}
generate_release_notes: false

- name: Publish ZetaCore Release Files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_VERSION }}
run: |
touch .release-env
make release-zetacore

- name: Artifact Attestations
id: attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: |
dist/zetacored_**/*
dist/checksums.txt

- name: Upload Attestation Bundle
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload ${{ env.GITHUB_TAG_VERSION }} ${{ steps.attestation.outputs.bundle-path }}

- name: Clean Up Workspace
if: always()
shell: bash
run: sudo rm -rf * || echo "failed to cleanup workspace please investigate"
4 changes: 3 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ jobs:
cat changelog-current.md

- name: Set Version
env:
VERSION_INPUT: ${{ inputs.version }}
run: |
echo "GITHUB_TAG_VERSION=${{ inputs.version }}" >> ${GITHUB_ENV}
echo "GITHUB_TAG_VERSION=${VERSION_INPUT}" >> ${GITHUB_ENV}

- name: Create Release Tag
shell: bash
Expand Down
81 changes: 81 additions & 0 deletions .goreleaser-zetaclient.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
env:
- CGO_ENABLED=1
- CC_linux_arm64=aarch64-linux-gnu-gcc
- CXX_linux_arm64=aarch64-linux-gnu-g++
- CC_linux_amd64=x86_64-linux-gnu-gcc
- CXX_linux_amd64=x86_64-linux-gnu-g++
- VERSION={{ .Version }}
- BUILDTIME={{ .Date }}

before:
hooks:
- go mod download
- go mod tidy

builds:
- id: "zetaclientd"
main: ./cmd/zetaclientd
binary: "zetaclientd-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
goarch:
- arm64
- amd64
flags: &default_flags
- -tags=pebbledb,ledger
ldflags: &default_ldflags
- -X github.com/cosmos/cosmos-sdk/version.Name=zetacore
- -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored
- -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .FullCommit }}
- -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb
- -X github.com/zeta-chain/node/pkg/constant.Name=zetacored
- -X github.com/zeta-chain/node/pkg/constant.Version={{ .Version }}
- -X github.com/zeta-chain/node/pkg/constant.CommitHash={{ .FullCommit }}
- -X github.com/zeta-chain/node/pkg/constant.BuildTime={{ .CommitDate }}
- -X main.version={{ .Version }}
- -X main.commit={{ .Commit }}
- -X main.date={{ .CommitDate }}
- -buildid=
- -s -w

- id: "zetae2e"
main: ./cmd/zetae2e
binary: "zetae2e-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
goarch:
- arm64
- amd64
flags: *default_flags
ldflags: *default_ldflags

archives:
- format: binary
name_template: "{{ .Binary }}"

checksum:
name_template: "checksums.txt"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

snapshot:
name_template: "{{ .Tag }}-next"

release:
draft: false
target_commitish: "{{ .FullCommit }}"
prerelease: auto
mode: append
Loading