-
-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (54 loc) · 1.92 KB
/
be.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
name: be
"on":
push:
branches:
- main
workflow_dispatch: {}
env:
DEPLOYMENT_MANIFEST_PATH: |
manifests/deploy-be.yaml
manifests/svc-be.yaml
jobs:
buildImage:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
name: Azure login
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- name: Build and push image to ACR
run: |
export VITE_COGNITO_USER_POOL_ID=${{ secrets.VITE_COGNITO_USER_POOL_ID }}
export VITE_COGNITO_CLIENT_ID=${{ secrets.VITE_COGNITO_CLIENT_ID }}
az acr build --image be:${{ github.sha }} --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} -f backend-container/Dockerfile.python backend-container/
az acr build --image be:latest --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} -f backend-container/Dockerfile.python backend-container/
deploy:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
needs: buildImage
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.CLUSTER_RESOURCE_GROUP }}
- name: Prepare Deployment Manifest
run: |
DATE=$(date +%s)
sed -i "s/{{.Date}}/$DATE/" manifests/deploy-be.yaml
- name: Deploy to Kubernetes
run: |
kubectl apply -f manifests/deploy-be.yaml
kubectl apply -f manifests/svc-be.yaml