-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (71 loc) · 2.22 KB
/
apps.yaml
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
name: cicd
env:
BUILD_NUMBER: v0.1.0-beta.${{ github.run_number }}
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build_backend:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: connect to acr
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: build and push container image
run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/backend:$BUILD_NUMBER
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/backend:$BUILD_NUMBER
working-directory: ./apps/backend
build_frontend:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: connect to acr
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: build and push container image
run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/frontend:$BUILD_NUMBER
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/frontend:$BUILD_NUMBER
working-directory: ./apps/frontend
deploy:
needs:
- build_backend
- build_frontend
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
RESOURCE_GROUP_NAME: dapr-testing
AKS_CLUSTER_NAME: dapr-testing
steps:
- name: git checkout
uses: actions/checkout@v2
- name: connect to aks
uses: azure/aks-set-context@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ env.AKS_CLUSTER_NAME }}
resource-group: ${{ env.RESOURCE_GROUP_NAME }}
- name: replace image tag token
uses: cschleiden/replace-tokens@v1
with:
tokenPrefix: '#{'
tokenSuffix: '}#'
files: '["k8s/apps/*.yaml"]'
env:
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
INSTRUMENTATION_KEY: ${{ secrets.INSTRUMENTATION_KEY }}
- name: apply k8s manifest
run: |
kubectl apply -f ./k8s/apps