-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.yml
More file actions
63 lines (57 loc) · 1.7 KB
/
workflow.yml
File metadata and controls
63 lines (57 loc) · 1.7 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
name: ${namespace}
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${namespace}
steps:
- uses: actions/checkout@v4
- name: Log in to ACR
uses: docker/login-action@v3
with:
registry: $${{ secrets.aks_container_registry_host }}
username: $${{ secrets.aks_container_registry_username }}
password: $${{ secrets.aks_container_registry_password }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${registry}/${image_name}:$${{ github.sha }}
- name: Deploy to AKS
env:
KUBECONFIG_CONTENT: $${{ secrets.KUBECONFIG }}
run: |
echo "$KUBECONFIG_CONTENT" > kubeconfig
cat > deployment.yml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${image_name}
namespace: ${namespace}
labels:
app: ${image_name}
spec:
replicas: 1
selector:
matchLabels:
app: ${image_name}
template:
metadata:
labels:
app: ${image_name}
spec:
containers:
- name: ${image_name}
image: ${registry}/${image_name}:$${{ github.sha }}
resources:
limits:
memory: "64Mi"
cpu: "100m"
imagePullSecrets:
- name: ${image_pull_secret}
EOF
kubectl --kubeconfig ./kubeconfig apply -f deployment.yml