Skip to content

Commit

Permalink
Update docker.yml to remove v in docker tag #23
Browse files Browse the repository at this point in the history
  • Loading branch information
KylinMountain authored Aug 23, 2024
1 parent d5f4a95 commit a5f2c81
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit a5f2c81

Please sign in to comment.