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 }}