From b6635192042c4723f39aefd59794f2deb523cbf4 Mon Sep 17 00:00:00 2001 From: Martial BE Date: Mon, 26 Feb 2024 10:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20ci:=20add=20dockerHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a82e67cd..71a1b9ae 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,7 +9,8 @@ on: env: # github.repository as / - IMAGE_NAME: martialbe/one-api + DOCKER_HUB_USERNAME: martialbe + DOCKER_HUB_REPO: one-api jobs: build-and-push: @@ -33,15 +34,24 @@ jobs: uses: docker/login-action@v2 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GT_Token }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ env.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} # Replace with your Docker Hub password secret - name: Docker meta id: meta uses: docker/metadata-action@v4 with: # list of Docker images to use as base name for tags - images: ghcr.io/${{ env.IMAGE_NAME }} + images: | + ghcr.io/${{ github.repository }} + docker.io/${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPO }} # generate Docker tags based on the following events/attributes tags: | type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}