From 0865147df11a8913ca4a17cd7f0c90522d3ecc15 Mon Sep 17 00:00:00 2001 From: Kylin Date: Fri, 23 Aug 2024 15:50:29 +0800 Subject: [PATCH] Update docker.yml --- .github/workflows/docker.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9824277be3..b37df98363 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -16,11 +16,18 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Remove 'v' prefix from tag + id: tag_name + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + TAG_NAME=${TAG_NAME#v} + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + - name: Log in to DockerHub run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin - name: Build the Docker image - run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }} - name: Push the Docker image - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}