From a525c85df2dcbb025dd9371bdec766b8569ab2f8 Mon Sep 17 00:00:00 2001 From: Samuel Rounce Date: Wed, 26 Jun 2024 10:17:10 +0100 Subject: [PATCH] feat: Release workflow pushes to Manifold GHCR --- .github/workflows/release.yaml | 27 +++++++++++++++++---------- Dockerfile | 4 +++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 959e65c1..bceca505 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,6 +20,10 @@ jobs: - name: Get tag version run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Get release date + run: | + echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} + - name: Print version run: | echo $RELEASE_VERSION @@ -27,14 +31,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker images id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@98675ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: flashbots/mev-boost + images: ghcr.io/${{ github.event.repository.full_name }} tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} type=sha - type=pep440,pattern={{version}} - type=pep440,pattern={{major}}.{{minor}} - type=raw,value=latest,enable=${{ !contains(env.RELEASE_VERSION, '-') }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -42,11 +46,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v3 @@ -55,6 +60,8 @@ jobs: push: true build-args: | VERSION=${{ env.RELEASE_VERSION }} + VCS_REF=${{ github.event.ref }} + BUILD_DATE=${{ env.RELEASE_DATE }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -120,4 +127,4 @@ jobs: with: args: release --config .goreleaser-release.yaml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index f090faa4..5c3df5e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1 FROM golang:1.22 as builder ARG VERSION +ARG VCS_REF +ARG BUILD_DATE WORKDIR /build COPY go.mod ./ @@ -15,7 +17,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux go -ldflags "-w -s -X 'github.com/flashbots/mev-boost/config.Version=$VERSION'" \ -o mev-boost . -FROM alpine:3.15 +FROM alpine:3.20.1 WORKDIR /app COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /build/mev-boost /app/mev-boost