-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 3.08 KB
/
deploy-azure.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Deploy to Azure
on:
workflow_dispatch:
jobs:
run-migrations:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.100
- name: Run migrator
run: dotnet run --configuration Release --project src/backend/src/FoodDiary.Migrator/FoodDiary.Migrator.csproj "${{ secrets.Migrator_DatabaseConnectionString }}"
push-image:
runs-on: ubuntu-22.04
needs: run-migrations
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: https://index.docker.io/v1/
username: ${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}
password: ${{ secrets.AzureAppService_ContainerPassword_f7974bea4cb74acab7e80b5c884a8659 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v5
with:
push: true
tags: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}
file: ./Dockerfile
deploy-yandex-cloud:
runs-on: ubuntu-22.04
needs: push-image
steps:
- name: Checkout to the branch
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.FOODDIARY_AZURE_CREDENTIALS }}
- name: Deploy to Azure Container Apps
uses: azure/container-apps-deploy-action@v2
with:
containerAppName: food-diary
resourceGroup: rg-food-diary
imageToDeploy: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}
deploy-container-apps:
runs-on: ubuntu-22.04
needs: push-image
steps:
- name: Checkout to the branch
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.FOODDIARY_AZURE_CREDENTIALS }}
- name: Deploy to Azure Container Apps
uses: azure/container-apps-deploy-action@v2
with:
containerAppName: food-diary
resourceGroup: rg-food-diary
imageToDeploy: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}
deploy-app-service:
runs-on: ubuntu-22.04
needs: push-image
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'food-diary'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_d39bb6452cd540d78f4dd9fe3526ed62 }}
images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}'