From 416f91650521fdd31377dc939cfbf8c7e497fcb3 Mon Sep 17 00:00:00 2001 From: Cursor <50294305+LoveU3th@users.noreply.github.com> Date: Thu, 23 May 2024 16:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E4=BF=AEgithub=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/Build and Push Docker Image.yml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Build and Push Docker Image.yml b/.github/workflows/Build and Push Docker Image.yml index 3c40077..4b24d0a 100644 --- a/.github/workflows/Build and Push Docker Image.yml +++ b/.github/workflows/Build and Push Docker Image.yml @@ -5,6 +5,11 @@ on: branches: - master # Replace with your branch name if different +env: + DOCKER_HUB_USERNAME: cursor1st + DOCKER_HUB_REPO: override # Replace with your repo name + + jobs: build-and-push: runs-on: ubuntu-latest @@ -12,6 +17,16 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 + # - name: Save dev version info + # run: | + # HASH=$(git rev-parse --short=7 HEAD) + # echo "dev-$HASH" > VERSION + + # - name: Save Tag version info + # if: startsWith(github.ref, 'refs/tags/') + # run: | + # git describe --tags > VERSION + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -26,12 +41,13 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: cursor1st/override + images: | + docker.io/${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPO }} tags: | - type=ref,event=tag + type=raw,value=dev,enable=${{ github.ref == 'refs/heads/master' }} + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} type=semver,pattern={{version}} - type=raw,value=latest - + - name: Build and push Docker image uses: docker/build-push-action@v5 with: