-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (62 loc) · 2.61 KB
/
deploy.yml
File metadata and controls
74 lines (62 loc) · 2.61 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Build and deploy images to Azure Container Apps
on:
push:
branches:
[ main ]
# Allow mannually trigger
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to container registry
uses: docker/login-action@v1
with:
registry: snekscr.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push 'snakessilo' image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: snekscr.azurecr.io/sneks-silo:${{ github.sha }}
file: ./SnakesSilo/Dockerfile
build-args: GIT_SHA=${{ github.sha }}
- name: Build and push 'sneks-hub' image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: snekscr.azurecr.io/sneks-hub:${{ github.sha }}
file: ./HubAndHost/Dockerfile
build-args: GIT_SHA=${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploying 'sneks-silo' and 'sneks-hub' to containerapp
uses: azure/CLI@v1
with:
inlineScript: |
echo "Installing containerapp extension"
az extension add --name containerapp --yes
echo "Setting registry for 'sneks-silo'"
az containerapp registry set -n sneks-silo -g sneks-rg --server snekscr.azurecr.io --username ${{ secrets.REGISTRY_USERNAME }} --password ${{ secrets.REGISTRY_PASSWORD }} --debug
echo "Starting Deploying 'sneks-silo'"
az containerapp update -n sneks-silo -g sneks-rg --image snekscr.azurecr.io/sneks-silo:${{ github.sha }}
echo "Setting registry for 'sneks-hub'"
az containerapp registry set -n sneks-hub -g sneks-rg --server snekscr.azurecr.io --username ${{ secrets.REGISTRY_USERNAME }} --password ${{ secrets.REGISTRY_PASSWORD }} --debug
echo "Starting Deploying 'sneks-hub'"
az containerapp update -n sneks-hub -g sneks-rg --image snekscr.azurecr.io/sneks-hub:${{ github.sha }}