diff --git a/.github/meta/bera-geth.png b/.github/meta/bera-geth.png new file mode 100644 index 0000000000..d4f37ab3c8 Binary files /dev/null and b/.github/meta/bera-geth.png differ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10079d76c2..7813970a6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f79d048dff..0837b717a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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<> $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 | | + | Non-Payload Builders | | + + ## All Changes + + ${{ steps.changelog.outputs.CHANGELOG }} + + ## Binaries + + | System | Architecture | Binary | Notes | + |:---:|:---:|:---:|:---| + | | 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 | + | | 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 | + | | 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 | + | | 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 | + | | 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) | + | | 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+) | + | | - | [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) | + | | - | [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** | + | | 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 diff --git a/build/ci.go b/build/ci.go index 6f96fd7715..9d83c2c51d 100644 --- a/build/ci.go +++ b/build/ci.go @@ -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-. - Version tag publish on GitHub, Geth only - // - ethereum/client-go:alltools-release-. - 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.. - Version tag publish on GitHub, Geth only // - ethereum/client-go:alltools-v.. - 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")