Skip to content

Workflow file for this run

name: Build and deploy .NET application to container app discordbotabordelv2-app-20230528
on:
release:
types: [ published ]
env:
CONTAINER_APP_CONTAINER_NAME: discordbotabordelv2
CONTAINER_APP_NAME: discordbotabordelv2-app-20230528
CONTAINER_APP_RESOURCE_GROUP_NAME: rg-BotabordelV2CA
CONTAINER_REGISTRY_LOGIN_SERVER: discordbotabordelv220230528141555.azurecr.io
DOCKER_FILE_PATH: ./Discord.BotABordelV2/Dockerfile
PROJECT_NAME_FOR_DOCKER: discordbotabordelv2
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to container registry
uses: docker/login-action@v2
with:
registry: ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.DiscordBotABordelV220230528141555_USERNAME_BE64 }}
password: ${{ secrets.DiscordBotABordelV220230528141555_PASSWORD_BE64 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }}/${{ env.PROJECT_NAME_FOR_DOCKER }}:${{ github.event.release.tag_name }} , ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }}/${{ env.PROJECT_NAME_FOR_DOCKER }}:latest
file: ${{ env.DOCKER_FILE_PATH }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.discordbotabordelv2_app_20230528_SPN }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: >
az config set extension.use_dynamic_install=yes_without_prompt
az containerapp registry set --name ${{ env.CONTAINER_APP_NAME }} --resource-group ${{ env.CONTAINER_APP_RESOURCE_GROUP_NAME }} --server ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }} --username ${{ secrets.DiscordBotABordelV220230528141555_USERNAME_BE64 }} --password ${{ secrets.DiscordBotABordelV220230528141555_PASSWORD_BE64 }}
az containerapp update --name ${{ env.CONTAINER_APP_NAME }} --container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} --resource-group ${{ env.CONTAINER_APP_RESOURCE_GROUP_NAME }} --image ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }}/${{ env.PROJECT_NAME_FOR_DOCKER }}:${{ github.ref_name }}
- name: logout
run: >
az logout