-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.88 KB
/
Copy pathdeploy_queue_to_azure.yml
File metadata and controls
58 lines (47 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Deploy Celery queue to Azure Container App
env:
ENV: ${{ github.ref_name == 'production' && 'production' || 'staging' }}
DOCKER_REGISTRY_NAME: ${{ vars.DOCKER_REGISTRY_NAME }}
DOCKER_REGISTRY_URI: ${{ vars.DOCKER_REGISTRY_NAME }}.azurecr.io
DOCKER_IMAGE_NAME: ${{ vars.DOCKER_IMAGE_NAME }}/queue
AZURE_CONTAINER_NAME_PREFIX: ${{ vars.AZURE_CONTAINER_NAME_PREFIX }}
on:
push:
branches: [ "production", "development" ]
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-publish:
uses: ./.github/workflows/docker_publish_images.yml
secrets: inherit
deploy:
needs: build-and-publish
runs-on: ubuntu-latest
permissions:
contents: read
environment: ${{ github.ref_name == 'production' && 'production' || 'staging' }}
steps:
- name: Print the environment deploying
run: echo "The environment is ${{ env.ENV }}"
- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ env.DOCKER_REGISTRY_URI }}
username: ${{ secrets.AZURE_REGISTRY_USERNAME }}
password: ${{ secrets.AZURE_REGISTRY_PASSWORD }}
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Build and deploy Container App
uses: azure/container-apps-deploy-action@v1
with:
acrName: ${{ env.DOCKER_REGISTRY_NAME }}
containerAppName: '${{ env.AZURE_CONTAINER_NAME_PREFIX }}${{ env.ENV }}'
resourceGroup: ${{ env.ENV }}
imageToDeploy: '${{ env.DOCKER_REGISTRY_URI }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}'
acrUsername: ${{ secrets.AZURE_REGISTRY_USERNAME }}
acrPassword: ${{ secrets.AZURE_REGISTRY_PASSWORD }}