File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,17 +46,16 @@ jobs:
4646 echo "TAG=dev" >> $GITHUB_ENV
4747 elif [[ "${{ github.ref }}" == "refs/heads/demo" ]]; then
4848 echo "TAG=demo" >> $GITHUB_ENV
49+ else
50+ echo "TAG=github.ref_name" >> $GITHUB_ENV
4951 fi
5052
51- - name : Build and push Docker image
52- if : ${{ github.ref_name == 'main' }}
53+ - name : Build and push Docker image optionally
5354 run : |
5455 docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }} -f WebApp.Dockerfile .
55- docker push ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }}
56-
57- - name : Build and push Docker image (Dev/Demo)
58- if : ${{ github.ref_name == 'dev' || github.ref_name == 'demo' }}
59- run : |
60- docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/webapp:latest -f WebApp.Dockerfile .
61- docker push ${{ secrets.ACR_LOGIN_SERVER }}/webapp:latest
56+ if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" ]]; then
57+ docker push ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }}
58+ else
59+ echo "Skipping Docker push for tag: ${{ env.TAG }}"
60+ fi
6261
You can’t perform that action at this time.
0 commit comments