Skip to content

Commit

Permalink
CI: publish docker image to ghrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Giacomo Licari committed Feb 26, 2024
1 parent e4d8374 commit 34e517b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 65 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ on:
tags:
- '*'

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
goreleaser:
permissions:
contents: write
runs-on:
- environment=production
- size=xlarge
- provider=ethpandaops
- realm=platform
contents: read
packages: write
runs-on: ubuntu-latest
steps:
-
name: Checkout
Expand Down Expand Up @@ -63,11 +66,12 @@ jobs:
with:
endpoint: builders
-
name: Login to DockerHub
name: Login to docker registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update GoReleaser config
run: |
cp .goreleaser.yaml ../.goreleaser.yaml.new
Expand All @@ -88,3 +92,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_SUFFIX: ${{ env.RELEASE_SUFFIX }}
REGISTRY: ${{ env.REGISTRY }}
81 changes: 25 additions & 56 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ builds:
ignore:
- goarch: 386
ldflags:
- -s -w -X github.com/ethpandaops/checkpointz/pkg/version.Release={{.Tag}} -X github.com/ethpandaops/checkpointz/pkg/version.GitCommit={{.ShortCommit}}
- -s -w -X github.com/gnosischain/checkpointz/pkg/version.Release={{.Tag}} -X github.com/gnosischain/checkpointz/pkg/version.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"
checksum:
name_template: 'checksums.txt'
Expand All @@ -43,10 +43,8 @@ dockers:
goarch: amd64
dockerfile: goreleaser-scratch.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-amd64"
- "samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64"
- "gnosischain/{{ .ProjectName }}:{{ .Version }}-amd64"
- "gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -58,10 +56,8 @@ dockers:
goarch: arm64
dockerfile: goreleaser-scratch.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-arm64v8"
- "gnosischain/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -74,10 +70,8 @@ dockers:
goarch: amd64
dockerfile: goreleaser-debian.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-debian-amd64"
- "samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-amd64"
- "ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64"
- "gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-amd64"
- "gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -89,10 +83,8 @@ dockers:
goarch: arm64
dockerfile: goreleaser-debian.Dockerfile
image_templates:
- "samcm/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8"
- "samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8"
- "ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8"
- "gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8"
- "gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -101,50 +93,27 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
docker_manifests:
## Scratch
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}
- name_template: gnosischain/{{ .ProjectName }}:{{ .Version }}
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-amd64
- samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: samcm/{{ .ProjectName }}:{{ .Version }}-arm64
- gnosischain/{{ .ProjectName }}:{{ .Version }}-amd64
- gnosischain/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: gnosischain/{{ .ProjectName }}:{{ .Version }}-arm64
image_templates:
- samcm/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest
- gnosischain/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest
image_templates:
- samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64
- samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}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 }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64
- ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-arm64v8
- gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}latest-amd64
- gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}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 }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest
image_templates:
- samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64
- samcm/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian
- name_template: gnosischain/{{ .ProjectName }}:{{ .Version }}-debian
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-amd64
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64
- gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-amd64
- gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-arm64
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest
- gnosischain/{{ .ProjectName }}:{{ .Version }}-debian-arm64v8
- name_template: gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest
image_templates:
- ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64
- ethpandaops/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8
- gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-amd64
- gnosischain/{{ .ProjectName }}:{{ if .Env.RELEASE_SUFFIX }}{{ .Env.RELEASE_SUFFIX }}-{{ end }}debian-latest-arm64v8

0 comments on commit 34e517b

Please sign in to comment.