From cfd0b89a43fd56664f5a56b4e6b309533b2e0660 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Mon, 15 Apr 2024 18:36:31 -0700 Subject: [PATCH] Publish docker image to github registry via ci When a pull request is merged into the main branch, this will trigger the building and publishing of a docker image. That is in addition to when a tag starting with "v" (e.g. v0.1.0) is pushed. --- .github/workflows/release.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de3dfda64..021ef663a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,10 @@ on: push: tags: - 'v*' + branches: [ main ] + +env: + REGISTRY: ghcr.io jobs: docker-image: @@ -33,19 +37,25 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: flashbots/mev-boost-relay + images: ${{ env.REGISTRY }}/${{ github.actor }}/prof-relay tags: | type=sha type=pep440,pattern={{version}} type=pep440,pattern={{major}}.{{minor}} type=raw,value=latest,enable=${{ !contains(env.RELEASE_VERSION, '-') }} - - name: Login to DockerHub + #- name: Login to DockerHub + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Go Build Cache for Docker uses: actions/cache@v3 with: @@ -72,6 +82,7 @@ jobs: github-release: runs-on: ubuntu-latest + if: github.ref == 'refs/tags/v*' steps: - name: Checkout sources uses: actions/checkout@v2