2323 - name : Set up Docker Buildx
2424 uses : docker/setup-buildx-action@v1
2525
26+ - name : Get current date
27+ id : date
28+ run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
29+
2630 - name : Log in to Azure Container Registry
2731 if : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }}
2832 uses : azure/docker-login@v2
@@ -31,19 +35,19 @@ jobs:
3135 username : ${{ env.ACR_USERNAME }}
3236 password : ${{ env.ACR_PASSWORD }}
3337
34- - name : Set Docker image tag
38+ - name : Set Docker image tag with Date
3539 run : |
3640 echo "Determining tag for branch: ${{ github.ref }}"
3741 if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
38- echo "TAG=latest" >> $GITHUB_ENV
42+ echo "TAG=latest-${{ steps.date.outputs.date }} " >> $GITHUB_ENV
3943 elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
40- echo "TAG=dev" >> $GITHUB_ENV
44+ echo "TAG=dev-${{ steps.date.outputs.date }} " >> $GITHUB_ENV
4145 elif [[ "${{ github.ref }}" == "refs/heads/demo" ]]; then
42- echo "TAG=demo" >> $GITHUB_ENV
46+ echo "TAG=demo-${{ steps.date.outputs.date }} " >> $GITHUB_ENV
4347 elif [[ "${{ github.ref }}" == "refs/heads/hotfix" ]]; then
44- echo "TAG=hotfix" >> $GITHUB_ENV
48+ echo "TAG=hotfix-${{ steps.date.outputs.date }} " >> $GITHUB_ENV
4549 else
46- echo "TAG=pullrequest-ignore" >> $GITHUB_ENV
50+ echo "TAG=pullrequest-ignore-${{ steps.date.outputs.date }} " >> $GITHUB_ENV
4751 fi
4852 echo "Tag set to: $TAG"
4953
5357 IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessor:${TAG}"
5458 echo "Using image name: ${IMAGE_NAME}"
5559 docker build -t ${IMAGE_NAME} -f .devcontainer/Dockerfile .
56- if [[ "${TAG}" == " latest" || "${TAG}" == " dev" || "${TAG}" == " demo" || "${TAG}" == " hotfix" ]]; then
60+ if [[ "${TAG}" == latest-* || "${TAG}" == dev-* || "${TAG}" == demo-* || "${TAG}" == hotfix-* ]]; then
5761 docker push ${IMAGE_NAME}
5862 echo "ContentProcessor image built and pushed successfully."
5963 else
6670 IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessorapi:${TAG}"
6771 echo "Using image name: ${IMAGE_NAME}"
6872 docker build -t ${IMAGE_NAME} -f .devcontainer/Dockerfile .
69- if [[ "${TAG}" == " latest" || "${TAG}" == " dev" || "${TAG}" == " demo" || "${TAG}" == " hotfix" ]]; then
73+ if [[ "${TAG}" == latest-* || "${TAG}" == dev-* || "${TAG}" == demo-* || "${TAG}" == hotfix-* ]]; then
7074 docker push ${IMAGE_NAME}
7175 echo "ContentProcessorAPI image built and pushed successfully."
7276 else
7983 IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessorweb:${TAG}"
8084 echo "Using image name: ${IMAGE_NAME}"
8185 docker build -t ${IMAGE_NAME} -f .devcontainer/base.Dockerfile .
82- if [[ "${TAG}" == " latest" || "${TAG}" == " dev" || "${TAG}" == " demo" || "${TAG}" == " hotfix" ]]; then
86+ if [[ "${TAG}" == latest-* || "${TAG}" == dev-* || "${TAG}" == demo-* || "${TAG}" == hotfix-* ]]; then
8387 docker push ${IMAGE_NAME}
8488 echo "ContentProcessorWeb image built and pushed successfully."
8589 else
0 commit comments