3232 uses : docker/setup-buildx-action@v1
3333
3434 - name : Log in to Azure Container Registry
35- if : ${{ (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix') }}
35+ if : ${{ (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' || github.ref_name == 'feature/conregchanges' ) }}
3636 uses : azure/docker-login@v2
3737 with :
3838 login-server : ${{ secrets.ACR_LOGIN_SERVER }}
4141
4242 - name : Set Docker image tag
4343 run : |
44+ DATE_TAG=$(date +'%Y-%m-%d')
45+ RUN_ID=${{ github.run_number }}
46+
4447 if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
4548 echo "TAG=latest" >> $GITHUB_ENV
4649 elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
@@ -49,24 +52,35 @@ jobs:
4952 echo "TAG=demo" >> $GITHUB_ENV
5053 elif [[ "${{ github.ref }}" == "refs/heads/hotfix" ]]; then
5154 echo "TAG=hotfix" >> $GITHUB_ENV
55+ elif [[ "${{ github.ref }}" == "refs/heads/feature/conregchanges" ]]; then
56+ echo "TAG=conregchanges" >> $GITHUB_ENV
5257 else
5358 echo "TAG=pullrequest-ignore" >> $GITHUB_ENV
5459 fi
60+
61+ echo "HISTORICAL_TAG=${TAG}_${DATE_TAG}_${RUN_ID}" >> $GITHUB_ENV
62+
5563
5664 - name : Build and push Docker images optionally
5765 run : |
5866 cd src/backend
5967 docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} -f Dockerfile . && \
60- if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
68+ docker tag ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.HISTORICAL_TAG }} && \
69+
70+ if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" || "${{ env.TAG }}" == "conregchanges" ]]; then
6171 docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} && \
72+ docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.HISTORICAL_TAG }} && \
6273 echo "Backend image built and pushed successfully."
6374 else
6475 echo "Skipping Docker push for backend with tag : ${{ env.TAG }}"
6576 fi
6677 cd ../frontend
6778 docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} -f Dockerfile . && \
68- if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
79+ docker tag ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.HISTORICAL_TAG }} && \
80+
81+ if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" || "${{ env.TAG }}" == "conregchanges" ]]; then
6982 docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} && \
83+ docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.HISTORICAL_TAG }} && \
7084 echo "Frontend image built and pushed successfully."
7185 else
7286 echo "Skipping Docker push for frontend with tag : ${{ env.TAG }}"
0 commit comments