Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): GoReleaser #64

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55 changes: 0 additions & 55 deletions .github/workflows/publish.yml

This file was deleted.

151 changes: 151 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
project_name: ethereum-metrics-exporter

before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
binary: ethereum-metrics-exporter-{{.Version}}
goos:
- linux
- windows
- darwin

goarch:
- amd64
- arm64
goarm:
- 6
- 7
ignore:
- goarch: 386
- goos: windows
goarch: arm64
ldflags:
- -s -w -X github.com/ethpandaops/ethereum-metrics-exporter/pkg/exporter/version.Release={{.Tag}} -X github.com/ethpandaops/ethereum-metrics-exporter/pkg/exporter/version.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

dockers:
## Scratch
- use: buildx
goos: linux
goarch: amd64
dockerfile: goreleaser-scratch.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-amd64"
- "samcm/{{ .ProjectName }}:latest-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ethpandaops/{{ .ProjectName }}:latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- use: buildx
goos: linux
goarch: arm64
dockerfile: goreleaser-scratch.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "samcm/{{ .ProjectName }}:latest-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "ethpandaops/{{ .ProjectName }}:latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
## Debian
- use: buildx
goos: linux
goarch: amd64
dockerfile: goreleaser-debian.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-debian-amd64"
- "samcm/{{ .ProjectName }}:debian-latest-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-amd64"
- "ethpandaops/{{ .ProjectName }}:debian-latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- use: buildx
goos: linux
goarch: arm64
dockerfile: goreleaser-debian.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8"
- "samcm/{{ .ProjectName }}:debian-latest-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8"
- "ethpandaops/{{ .ProjectName }}:debian-latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
docker_manifests:
## Scratch
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-amd64
- samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}-arm64
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: samcm/{{ .ProjectName }}:latest
image_templates:
- samcm/{{ .ProjectName }}:latest-amd64
- samcm/{{ .ProjectName }}:latest-arm64v8

- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-amd64
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}-arm64
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:latest
image_templates:
- ethpandaops/{{ .ProjectName }}:latest-amd64
- ethpandaops/{{ .ProjectName }}:latest-arm64v8

## Debian
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}-debian
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-debian-amd64
- samcm/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}-debian-arm64
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: samcm/{{ .ProjectName }}:debian-latest
image_templates:
- samcm/{{ .ProjectName }}:debian-latest-amd64
- samcm/{{ .ProjectName }}:debian-latest-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-amd64
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:debian-latest
image_templates:
- ethpandaops/{{ .ProjectName }}:debian-latest-amd64
- ethpandaops/{{ .ProjectName }}:debian-latest-arm64v8
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/ethereum/go-ethereum v1.10.17
github.com/ethpandaops/beacon v0.14.0
github.com/ethpandaops/beacon v0.18.0
github.com/onrik/ethrpc v1.0.0
github.com/prometheus/client_golang v1.13.0
github.com/sirupsen/logrus v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.10.17 h1:XEcumY+qSr1cZQaWsQs5Kck3FHB0V2RiMHPdTBJ+oT8=
github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0=
github.com/ethpandaops/beacon v0.14.0 h1:JSh3r0Z55UDP3sl95g72YOxwjAr4nnCTf9jElJ10MBw=
github.com/ethpandaops/beacon v0.14.0/go.mod h1:fkS2U962xdB6+VwBn+J+DMK8cTgTtzVtjZWtvTKjbuE=
github.com/ethpandaops/beacon v0.18.0 h1:SIozlv8RVtr7nOn4B4/KtfnggGe3Xs1RAhA6JGjyujw=
github.com/ethpandaops/beacon v0.18.0/go.mod h1:fkS2U962xdB6+VwBn+J+DMK8cTgTtzVtjZWtvTKjbuE=
github.com/ethpandaops/ethwallclock v0.2.0 h1:EeFKtZ7v6TAdn/oAh0xaPujD7N4amjBxrWIByraUfLM=
github.com/ethpandaops/ethwallclock v0.2.0/go.mod h1:y0Cu+mhGLlem19vnAV2x0hpFS5KZ7oOi2SWYayv9l24=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
Expand Down
3 changes: 3 additions & 0 deletions goreleaser-debian.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian:latest
COPY ethereum-metrics-exporter* /exporter
ENTRYPOINT ["/exporter"]
3 changes: 3 additions & 0 deletions goreleaser-scratch.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM gcr.io/distroless/static-debian11:latest
COPY ethereum-metrics-exporter* /exporter
ENTRYPOINT ["/exporter"]