Skip to content

Commit

Permalink
ci(build_publish): publish also on tag
Browse files Browse the repository at this point in the history
Publishes another image under a tagged url.
  • Loading branch information
nitaibezerra committed Mar 16, 2023
1 parent d112473 commit 4b078a0
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/docker_build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Build and Publish Docker Image

on:
push:
branches:
- main
- build_publish_image
tags:
- '*'

jobs:
build_and_push:
Expand All @@ -23,9 +22,20 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
- name: Extract tag name
shell: bash
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV

- name: Build and push Docker image with tag
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}

- name: Build and push Docker image with latest tag
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/ro-dou:latest
tags: ghcr.io/${{ github.repository }}:latest

0 comments on commit 4b078a0

Please sign in to comment.