Better error handling when adding INCS #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push to ACR | |
on: | |
push: | |
branches: | |
- "main" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: "Build and Push to ACR" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.AZURE_URL }} | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Azure Login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Delete All Images in ACR | |
run: | | |
# Delete all images in the 'incstats' repository | |
az acr repository show-tags --name sbuincstatsnorwayeastecr --repository incstats --query "[*]" -o tsv | \ | |
while read -r image; do | |
echo "Deleting image: incstats:$image" | |
az acr repository delete --name sbuincstatsnorwayeastecr --image incstats:$image --yes | |
done | |
- name: Build and Push to ACR | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ secrets.AZURE_URL }}/incstats:${{ github.sha }} | |
file: Dockerfile | |
- name: Redeploy Azure Container App | |
run: | | |
az containerapp revision copy \ | |
--name sbu-inslack-nea-app \ | |
--resource-group sbu-public-incstats-net-nea-rg \ | |
--cpu 0.5 \ | |
--memory 1.0 \ | |
--image ${{ secrets.AZURE_URL }}/incstats:${{ github.sha }} |