chore(CI): Fix download links in draft releases (#16)

* try release fix

* fix links
This commit is contained in:
Cal Bera 2025-06-24 11:02:02 -07:00 committed by GitHub
parent d80965096e
commit 1e7463308d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -4,6 +4,7 @@ on:
push:
branches:
- "main"
- "fix-ci-3" # TODO: remove this
tags:
- "v1.*"
@ -14,7 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
else
# For branch builds, use a test version
echo "VERSION=v1.test-branch" >> $GITHUB_OUTPUT
fi
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}
@ -46,10 +53,10 @@ jobs:
- name: Upload artifacts (amd64)
uses: actions/upload-artifact@v4
with:
name: geth-linux-amd64-archives
name: bera-geth-linux-amd64-archives
path: |
geth-linux-amd64-*.tar.gz
geth-alltools-linux-amd64-*.tar.gz
bera-geth-linux-amd64-*.tar.gz
bera-geth-alltools-linux-amd64-*.tar.gz
- name: Cleanup bin
run: rm -f build/bin/*
@ -81,10 +88,10 @@ jobs:
- name: Upload artifacts (arm64)
uses: actions/upload-artifact@v4
with:
name: linux-arm64-archives
name: bera-geth-linux-arm64-archives
path: |
geth-linux-arm64-*.tar.gz
geth-alltools-linux-arm64-*.tar.gz
bera-geth-linux-arm64-*.tar.gz
bera-geth-alltools-linux-arm64-*.tar.gz
- name: Cleanup bin
run: rm -fr build/bin/*
@ -126,7 +133,6 @@ jobs:
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:
@ -152,24 +158,45 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Debug: Show what was downloaded
echo "Contents of artifacts directory:"
ls -la ./artifacts/ || echo "Artifacts directory not found"
# Move all artifacts to current directory
if [ -d "./artifacts" ]; then
find ./artifacts -name "*.tar.gz" -exec mv {} . \;
else
echo "Warning: No artifacts directory found"
fi
# List available files for debugging
echo "Available files:"
ls -la *.tar.gz || echo "No tar.gz files found"
# Get actual archive names
GETH_AMD64=$(ls geth-linux-amd64-*.tar.gz | grep -v alltools | head -1)
GETH_ARM64=$(ls geth-linux-arm64-*.tar.gz | grep -v alltools | head -1)
GETH_ALLTOOLS_AMD64=$(ls geth-alltools-linux-amd64-*.tar.gz | head -1)
GETH_ALLTOOLS_ARM64=$(ls geth-alltools-linux-arm64-*.tar.gz | head -1)
GETH_AMD64=$(ls bera-geth-linux-amd64-*.tar.gz 2>/dev/null | grep -v alltools | head -1)
GETH_ARM64=$(ls bera-geth-linux-arm64-*.tar.gz 2>/dev/null | grep -v alltools | head -1)
GETH_ALLTOOLS_AMD64=$(ls bera-geth-alltools-linux-amd64-*.tar.gz 2>/dev/null | head -1)
GETH_ALLTOOLS_ARM64=$(ls bera-geth-alltools-linux-arm64-*.tar.gz 2>/dev/null | head -1)
echo "Found archives:"
echo " AMD64: $GETH_AMD64"
echo " ARM64: $GETH_ARM64"
echo " Alltools AMD64: $GETH_ALLTOOLS_AMD64"
echo " Alltools ARM64: $GETH_ALLTOOLS_ARM64"
echo " AMD64: ${GETH_AMD64:-NOT FOUND}"
echo " ARM64: ${GETH_ARM64:-NOT FOUND}"
echo " Alltools AMD64: ${GETH_ALLTOOLS_AMD64:-NOT FOUND}"
echo " Alltools ARM64: ${GETH_ALLTOOLS_ARM64:-NOT FOUND}"
# Determine the release tag
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# For tags, use the actual tag
RELEASE_TAG="${{ env.VERSION }}"
IS_PRERELEASE=""
else
# For branches, create a specific tag based on commit
RELEASE_TAG="test-${GITHUB_SHA::8}"
IS_PRERELEASE="--prerelease"
fi
echo "Release tag: $RELEASE_TAG"
body=$(cat <<- 'ENDBODY'
![bera-geth](https://raw.githubusercontent.com/berachain/bera-geth/main/.github/meta/bera-geth.png)
@ -199,10 +226,10 @@ jobs:
| System | Architecture | Binary | Notes |
|:---:|:---:|:---:|:---|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [GETH_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/GETH_AMD64_PLACEHOLDER) | Most Linux systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [GETH_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/GETH_ARM64_PLACEHOLDER) | 64-bit ARM systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | - | [GETH_ALLTOOLS_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/GETH_ALLTOOLS_AMD64_PLACEHOLDER) | All tools bundle (amd64) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | - | [GETH_ALLTOOLS_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/GETH_ALLTOOLS_ARM64_PLACEHOLDER) | All tools bundle (arm64) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [GETH_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_AMD64_PLACEHOLDER) | Most Linux systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [GETH_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ARM64_PLACEHOLDER) | 64-bit ARM systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [GETH_ALLTOOLS_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ALLTOOLS_AMD64_PLACEHOLDER) | All tools bundle (amd64) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [GETH_ALLTOOLS_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ALLTOOLS_ARM64_PLACEHOLDER) | 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) |
@ -223,19 +250,20 @@ jobs:
ENDBODY
)
# Replace placeholders with actual filenames
# Replace placeholders with actual filenames and release tag
body="${body//GETH_AMD64_PLACEHOLDER/$GETH_AMD64}"
body="${body//GETH_ARM64_PLACEHOLDER/$GETH_ARM64}"
body="${body//GETH_ALLTOOLS_AMD64_PLACEHOLDER/$GETH_ALLTOOLS_AMD64}"
body="${body//GETH_ALLTOOLS_ARM64_PLACEHOLDER/$GETH_ALLTOOLS_ARM64}"
body="${body//RELEASE_TAG_PLACEHOLDER/$RELEASE_TAG}"
# Create assets array for gh release
assets=()
for asset in geth-*.tar.gz; do
for asset in bera-geth-*.tar.gz; do
if [ -f "$asset" ]; then
assets+=("$asset")
fi
done
tag_name="${{ env.VERSION }}"
echo "$body" | gh release create --draft -t "Bera Geth $tag_name" -F "-" "$tag_name" "${assets[@]}"
# Create the release with the determined tag
echo "$body" | gh release create $IS_PRERELEASE --draft -t "Bera Geth $RELEASE_TAG" -F "-" "$RELEASE_TAG" "${assets[@]}"

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 != "main" && !strings.HasPrefix(env.Tag, "v1.") {
// TODO: remove this.
if env.Branch != "main" && env.Branch != "fix-ci-3" && !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)
}