Skip to content

Commit 691594f

Browse files
Update docker-build-and-push.yml
1 parent c6366b7 commit 691594f

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/docker-build-and-push.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,27 @@ jobs:
5050
echo "TAG=demo" >> $GITHUB_ENV
5151
elif [[ "${{ github.ref }}" == "refs/heads/hotfix" ]]; then
5252
echo "TAG=hotfix" >> $GITHUB_ENV
53+
else
54+
echo "TAG=github.ref_name" >> $GITHUB_ENV
5355
fi
54-
- name: Build and push Docker images
56+
57+
- name: Build and push Docker images optionally
5558
run: |
5659
cd src/backend
5760
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} -f Dockerfile . && \
58-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} && \
59-
echo "Backend image built and pushed successfully."
61+
if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
62+
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} && \
63+
echo "Backend image built and pushed successfully."
64+
else
65+
echo "Skipping Docker push for backend with tag: ${{ env.TAG }}"
66+
fi
6067
cd ../frontend
6168
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} -f Dockerfile . && \
62-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} && \
63-
echo "Frontend image built and pushed successfully."
69+
if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
70+
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} && \
71+
echo "Frontend image built and pushed successfully."
72+
else
73+
echo "Skipping Docker push for frontend with tag: ${{ env.TAG }}"
74+
fi
75+
6476

0 commit comments

Comments
 (0)