From 6c8a282743d9a987a993c09f8737642f014657b3 Mon Sep 17 00:00:00 2001 From: kyzooghost <73516204+kyzooghost@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:41:46 +1100 Subject: [PATCH] [Fix] Docker credentials in Github CI (#570) * docker credentials optional in bridge-ui-publish * docker credentials optional in all-tools --- .github/workflows/all-tools.yml | 3 +++ .github/workflows/bridge-ui-publish.yml | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all-tools.yml b/.github/workflows/all-tools.yml index 24d8a4a32..001807db8 100644 --- a/.github/workflows/all-tools.yml +++ b/.github/workflows/all-tools.yml @@ -82,6 +82,8 @@ jobs: COMMIT_TAG: ${{ needs.store_image_name_and_tags.outputs.commit_tag }} DEVELOP_TAG: ${{ needs.store_image_name_and_tags.outputs.develop_tag }} IMAGE_NAME: consensys/linea-alltools + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} name: All tools build and push steps: - name: Checkout @@ -89,6 +91,7 @@ jobs: with: submodules: true - name: Login to Docker Hub + if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} diff --git a/.github/workflows/bridge-ui-publish.yml b/.github/workflows/bridge-ui-publish.yml index e129c4b2e..b7d5d81f2 100644 --- a/.github/workflows/bridge-ui-publish.yml +++ b/.github/workflows/bridge-ui-publish.yml @@ -17,6 +17,9 @@ on: jobs: publish: runs-on: [self-hosted, ubuntu-20.04, X64, small] + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v4 @@ -32,6 +35,7 @@ jobs: run: echo "DOCKER_TAG=${GITHUB_SHA:0:7}-$(date +%s)-bridge-ui-${{ steps.package-version.outputs.current-version }}" | tee $GITHUB_ENV - name: Login to Docker Repository + if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -46,7 +50,7 @@ jobs: with: context: . file: ./bridge-ui/Dockerfile - push: true + push: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }} tags: consensys/linea-bridge-ui:${{ env.DOCKER_TAG }} # Env file dedicated for dev build-args: |