chore(CI): Setup release workflow (#13)

* rename ci job

* wip: revive release.yml

* try claude 4 opus max

* fix yaml error

* remove signing archives for now

* draft release job
This commit is contained in:
Cal Bera 2025-06-23 01:04:27 -07:00 committed by GitHub
parent 31e192db86
commit 61c4c97cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 127 additions and 33 deletions

BIN
.github/meta/bera-geth.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,4 +1,4 @@
name: i386 linux tests
name: CI
on:
push:
@ -32,7 +32,8 @@ jobs:
go run build/ci.go check_generate
go run build/ci.go check_baddeps
build:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

View file

@ -1,14 +1,27 @@
name: Release
on:
# TODO: fix release workflow and enable this.
# push:
# branches:
# - "main"
# tags:
# - "v*"
push:
branches:
- "main"
- "fix-ci" # TODO: remove fix-ci after testing.
tags:
- "v1.*"
jobs:
# Job to extract version
extract-version:
name: Extract Version
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}
linux-intel:
name: Linux Build
name: Linux Build (intel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -30,9 +43,7 @@ jobs:
- name: Create archive (amd64)
run: |
go run build/ci.go archive -arch amd64 -type tar -signer LINUX_SIGNING_KEY
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
go run build/ci.go archive -arch amd64 -type tar
- name: Upload artifacts (amd64)
uses: actions/upload-artifact@v4
with:
@ -47,9 +58,7 @@ jobs:
- name: Create archive (386)
run: |
go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
go run build/ci.go archive -arch 386 -type tar
- name: Upload artifacts (386)
uses: actions/upload-artifact@v4
with:
@ -82,9 +91,7 @@ jobs:
- name: Create archive (arm64)
run: |
go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
go run build/ci.go archive -arch arm64 -type tar
- name: Upload artifacts (arm64)
uses: actions/upload-artifact@v4
with:
@ -101,10 +108,9 @@ jobs:
- name: Create archive (arm5)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY
go run build/ci.go archive -arch arm -type tar
env:
GOARM: "5"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
- name: Upload artifacts (arm5)
uses: actions/upload-artifact@v4
with:
@ -121,10 +127,9 @@ jobs:
- name: Create archive (arm6)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY
go run build/ci.go archive -arch arm -type tar
env:
GOARM: "6"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
- name: Upload artifacts (arm6)
uses: actions/upload-artifact@v4
with:
@ -141,10 +146,9 @@ jobs:
- name: Create archive (arm7)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY
go run build/ci.go archive -arch arm -type tar
env:
GOARM: "7"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
- name: Upload artifacts (arm7)
uses: actions/upload-artifact@v4
with:
@ -186,3 +190,95 @@ jobs:
- name: Build and push multi-arch images to GHCR
run: |
go run build/ci.go dockerx -platform linux/amd64,linux/arm64 -hub ghcr.io/berachain/bera-geth -upload
release:
name: Draft Release
needs: [extract-version, linux-intel, linux-arm]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # This is necessary for generating the changelog
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Generate full changelog
id: changelog
run: |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create release draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Move all artifacts to current directory
find ./artifacts -name "*.tar.gz*" -exec mv {} . \;
body=$(cat <<- "ENDBODY"
![bera-geth](https://raw.githubusercontent.com/berachain/bera-geth/main/.github/meta/bera-geth.png)
## Summary
Add a summary, including:
- Critical bug fixes
- New features
- Any breaking changes (and what to expect)
## Update Priority
This table provides priorities for which classes of users should update particular components.
| User Class | Priority |
|----------------------|-----------------|
| Payload Builders | <TODO> |
| Non-Payload Builders | <TODO> |
## All Changes
${{ steps.changelog.outputs.CHANGELOG }}
## Binaries
| System | Architecture | Binary | Notes |
|:---:|:---:|:---:|:---|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [geth-linux-amd64-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-amd64-${{ env.VERSION }}.tar.gz) | Most Linux systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | 386 | [geth-linux-386-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-386-${{ env.VERSION }}.tar.gz) | Older Linux systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [geth-linux-arm64-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-arm64-${{ env.VERSION }}.tar.gz) | 64-bit ARM systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | armv5 | [geth-linux-arm-5-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-arm-5-${{ env.VERSION }}.tar.gz) | ARMv5 systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | armv6 | [geth-linux-arm-6-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-arm-6-${{ env.VERSION }}.tar.gz) | ARMv6 systems (Raspberry Pi Zero) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | armv7 | [geth-linux-arm-7-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-linux-arm-7-${{ env.VERSION }}.tar.gz) | ARMv7 systems (Raspberry Pi 2+) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | - | [geth-alltools-linux-amd64-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-alltools-linux-amd64-${{ env.VERSION }}.tar.gz) | All tools bundle (amd64) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | - | [geth-alltools-linux-arm64-${{ env.VERSION }}.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/geth-alltools-linux-arm64-${{ env.VERSION }}.tar.gz) | All tools bundle (arm64) |
| **System** | **Option** | - | **Resource** |
| <img src="https://simpleicons.org/icons/docker.svg" style="width: 32px;"/> | Docker | | [ghcr.io/berachain/bera-geth](https://ghcr.io/berachain/bera-geth) |
### Installation
The archives contain the geth binary and license file. Extract and run:
\`\`\`bash
tar -xzf geth-linux-amd64-${{ env.VERSION }}.tar.gz
./geth
\`\`\`
The **alltools** archives additionally contain:
- `abigen` - Source code generator for Ethereum contracts
- `evm` - Developer utility for the Ethereum Virtual Machine
- `rlpdump` - Developer utility for RLP data
- `clef` - Ethereum account management tool
ENDBODY
)
tag_name="${{ env.VERSION }}"
echo "$body" | gh release create --draft -t "Geth $tag_name" -F "-" "$tag_name" *.tar.gz

View file

@ -650,7 +650,8 @@ func maybeSkipArchive(env build.Environment) {
log.Printf("skipping archive creation because this is a PR build")
os.Exit(0)
}
if env.Branch != "master" && !strings.HasPrefix(env.Tag, "v1.") {
// TODO: remove fix-ci after testing.
if env.Branch != "main" && env.Branch != "fix-ci" && !strings.HasPrefix(env.Tag, "v1.") {
log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
os.Exit(0)
}
@ -679,21 +680,17 @@ func doDockerBuildx(cmdline []string) {
build.MustRun(auther)
}
// Retrieve the version infos to build and push to the following paths:
// - ethereum/client-go:latest - Pushes to the master branch, Geth only
// - ethereum/client-go:stable - Version tag publish on GitHub, Geth only
// - ethereum/client-go:alltools-latest - Pushes to the master branch, Geth & tools
// - ethereum/client-go:alltools-stable - Version tag publish on GitHub, Geth & tools
// - ethereum/client-go:release-<major>.<minor> - Version tag publish on GitHub, Geth only
// - ethereum/client-go:alltools-release-<major>.<minor> - Version tag publish on GitHub, Geth & tools
// - ethereum/client-go:latest - Pushes to the main branch, Geth only
// - ethereum/client-go:alltools-latest - Pushes to the main branch, Geth & tools
// - ethereum/client-go:v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth only
// - ethereum/client-go:alltools-v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth & tools
var tags []string
switch {
case env.Branch == "master":
case env.Branch == "main":
tags = []string{"latest"}
case strings.HasPrefix(env.Tag, "v1."):
tags = []string{"stable", fmt.Sprintf("release-%v", version.Family), "v" + version.Semantic}
tags = []string{env.Tag}
}
// Need to create a mult-arch builder
check := exec.Command("docker", "buildx", "inspect", "multi-arch-builder")