-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.12 KB
/
deploy.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
name: Build and deploy
on:
push:
branches:
- placeholder
- android-fix-wip
- main
- ci-fix
workflow_dispatch:
permissions:
id-token: write
env:
AZURE_CORE_OUTPUT: none
jobs:
build:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v2
- name: Log in to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
allow-no-subscriptions: true
- name: Docker login to ACR
run: az acr login --name ${{ secrets.REGISTRY_NAME }}
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: app
push: true
tags: ${{ secrets.REGISTRY_NAME }}.azurecr.io/kiltiskamera/backend:${{ github.sha }}
cache-from: type=gha,ref=${{ github.ref_name }}
cache-to: type=gha,mode=max
allow: |
network.host
network: host
- name: Azure logout
run: |
az logout
deploy:
runs-on: ubuntu-latest
environment: production
needs: build
steps:
- uses: actions/checkout@v2
- name: Log in to Azure
uses: Azure/login@v2
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
allow-no-subscriptions: true
- name: Docker login to ACR
run: az acr login --name ${{ secrets.REGISTRY_NAME }}
# Would like to use azure/webapps-deploy but it doesn't seem to work with OIDC.
- name: Deploy from ACR
run: |
az webapp config container set \
--container-image-name ${{ secrets.REGISTRY_NAME }}.azurecr.io/kiltiskamera/backend:${{ github.sha }} \
--container-registry-url https://${{ secrets.REGISTRY_NAME }}.azurecr.io \
--subscription ${{ secrets.SUBSCRIPTION }} \
--resource-group kiltiskamera_group \
--name kiltiskamera
- name: Azure logout
run: |
az logout