Skip to content

chore: Update release configuration #53

chore: Update release configuration

chore: Update release configuration #53

Workflow file for this run

name: goreleaser
on:
push:
branches:
- 'release/*'
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Get latest release version for this release branch
if: startsWith(github.ref, 'refs/heads/release/')
id: latest_version
run: |
# Extract suffix from branch name (e.g., 'dencun' from 'release/dencun')
RELEASE_SUFFIX=${GITHUB_REF#refs/heads/release/}
# Fetch all tags and get the latest that matches the pattern
LATEST_VERSION=$(curl --silent "https://api.github.com/repos/$GITHUB_REPOSITORY/releases" \
| jq -r --arg suffix "$RELEASE_SUFFIX" '.[] | select(.tag_name | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+-" + $suffix + "$")) | .tag_name' \
| sort -V | tail -n 1)
echo "Found latest $RELEASE_SUFFIX version: $LATEST_VERSION"
# Default to 0.0.0 if no matching release was found
if [[ -z "$LATEST_VERSION" ]]; then
LATEST_VERSION="0.0.0"
fi
# Increment the patch version using bash
LATEST_VERSION=$(echo "$LATEST_VERSION" | awk -F. -v OFS=. '{$NF = $NF + 1;} 1')
VERSION=$LATEST_VERSION-$RELEASE_SUFFIX
echo "Releasing version: $VERSION"
git config --global user.email "ethpandaops@ethereum.org"
git config --global user.name "ethpandaops"
git tag -a "$VERSION" -m "Release $VERSION"
echo "RELEASE_SUFFIX=$RELEASE_SUFFIX" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Install cross-compiler for linux/arm64
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Context for Buildx
shell: bash
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_SUFFIX: ${{ env.RELEASE_SUFFIX }}