Skip to content

Update dockerbuidimages.yaml #14

Update dockerbuidimages.yaml

Update dockerbuidimages.yaml #14

Workflow file for this run

name: Deploy Docker Image
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Login to Azure Container Registry
run: az acr login --name petdistriACR
- name: Read Image Name
run: |
export ORIGINAL_IMAGE_NAME=$(cat spring-petclinic-vets-service/image_name.txt)
echo "ORIGINAL_IMAGE_NAME=$ORIGINAL_IMAGE_NAME" >> $GITHUB_ENV
continue-on-error: false
- name: Debug Image Name
run: cat spring-petclinic-vets-service/image_name.txt
- name: Pull Docker Image
run: docker pull ${{ env.ORIGINAL_IMAGE_NAME }}
- name: Tag Docker Image
run: |
NEW_IMAGE_NAME="petdistriacr.azurecr.io/spring-petclinic-vets-service:deploy-${{ github.run_id }}"
docker tag ${{ env.ORIGINAL_IMAGE_NAME }} $NEW_IMAGE_NAME
echo "NEW_IMAGE_NAME=$NEW_IMAGE_NAME" >> $GITHUB_ENV
- name: Push Docker Image
run: docker push ${{ env.NEW_IMAGE_NAME }}
- name: Delete Temporary Branch
if: always()
run: |
git push origin --delete temp/image-info-${{ github.sha }} || echo "Branch already deleted."