Skip to content

Merge pull request #38 from ethpandaops/chore/default-cfg #33

Merge pull request #38 from ethpandaops/chore/default-cfg

Merge pull request #38 from ethpandaops/chore/default-cfg #33

Workflow file for this run

name: goreleaser
on:
push:
tags:
- '*'
jobs:
goreleaser:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Derive release suffix from tag (if it exists)
run: |
# Strip the 'refs/tags/' prefix
TAG_NAME=${GITHUB_REF#refs/tags/}
# Extract suffix from tag name after the last '-' (e.g., 'dencun' from 'v1.0.0-dencun')
RELEASE_SUFFIX=${TAG_NAME##*-}
# Check if the suffix is still a version pattern (e.g., 'v0.0.44'), in which case there's no suffix
if [[ $RELEASE_SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
RELEASE_SUFFIX=""
fi
echo "RELEASE_SUFFIX=$RELEASE_SUFFIX" >> $GITHUB_ENV
echo "Release suffix: $RELEASE_SUFFIX"
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.25.1'
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
name: Set up Node
with:
node-version: 18
- name: Run apt-get update
run: sudo apt-get update
- name: Install cross-compiler for linux/arm64
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Install make
run: sudo apt-get -y install make
- name: Create config.yaml for proto generation
run: |
cat > config.yaml << EOF
clickhouse:
dsn: "${{ secrets.CLICKHOUSE_DSN }}"
database: "${{ secrets.CLICKHOUSE_DATABASE }}"
discovery:
prefixes:
- fct
- int
- dim
- admin_cbt_incremental
exclude:
- "*_local" # Exclude all local tables
proto:
output_dir: "./pkg/proto/clickhouse"
package: "cbt.v1"
go_package: "github.com/ethpandaops/cbt-api/pkg/proto/clickhouse"
include_comments: true
api:
base_path: "/api/v1"
expose_prefixes:
- fct
- int
- dim
- admin_cbt_incremental
exclude:
- "*_local"
EOF
- name: Install tools, generate code and build
run: |
make install-tools
make build
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- 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@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
endpoint: builders
- name: Login to DockerHub
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update GoReleaser config
run: |
cp .goreleaser.yaml .goreleaser.yaml.new
# If we have a RELEASE_SUFFIX, update the goreleaser config to not set
# the release as the latest
if [[ -n "$RELEASE_SUFFIX" ]]; then
echo "release:" >> .goreleaser.yaml.new
echo " prerelease: true" >> .goreleaser.yaml.new
echo " make_latest: false" >> .goreleaser.yaml.new
fi
- name: Run GoReleaser in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-e DOCKER_USERNAME=${{ secrets.DOCKERHUB_USERNAME }} \
-e DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }} \
-v /var/run/docker.sock:/var/run/docker.sock \
-e RELEASE_SUFFIX=${{ env.RELEASE_SUFFIX }} \
goreleaser/goreleaser-cross:v1.25.1 release --clean --config .goreleaser.yaml.new