generated from FINTLabs/fint-flyt-instance-gateway-template
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.99 KB
/
cd.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
89
90
91
92
93
94
95
96
97
name: CD
on: push
jobs:
build-and-publish:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }}
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch,suffix=-{{sha}}
type=ref,event=pr,suffix=-{{sha}}
type=sha,prefix={{date 'YYYY-MM-DD-'}},enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Log in to the Container registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-to-aks:
name: ${{ matrix.org }}-${{ matrix.cluster }}
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
needs: build-and-publish
strategy:
fail-fast: false
matrix:
org: [ fintlabs-no, ofk-no ]
cluster: [ aks-beta-fint-2021-11-23 ]
include:
- cluster: aks-beta-fint-2021-11-23
deploy-every-branch: true
steps:
- uses: actions/checkout@v4
- name: Get environment
id: environment
run: |
echo "name=$(cut -d\- -f2 <<< ${{ matrix.cluster }})" >> $GITHUB_OUTPUT
- name: Bake manifests with Kustomize
id: bake
uses: azure/k8s-bake@v2
with:
renderEngine: 'kustomize'
kustomizationPath: 'kustomize/overlays/${{ matrix.org }}/${{ steps.environment.outputs.name }}'
- name: Login to Azure
uses: azure/login@v1
with:
creds: "${{ secrets[format('AKS_{0}_FINT_GITHUB', steps.environment.outputs.name)] }}"
- name: Set the target cluster
uses: azure/aks-set-context@v3
with:
cluster-name: ${{ matrix.cluster }}
resource-group: rg-aks-${{ steps.environment.outputs.name }}
admin: true
- if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && matrix.deploy-every-branch != true
run: |
{
echo "## Dry run - not a real deploy"
echo "To deploy, merge to ${{ github.event.repository.default_branch }}."
} >> $GITHUB_STEP_SUMMARY
- name: Deploy to Kubernetes
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || matrix.deploy-every-branch == true
uses: azure/k8s-deploy@v4
with:
action: deploy
manifests: ${{ steps.bake.outputs.manifestsBundle }}
images: ${{ needs.build-and-publish.outputs.tags }}
namespace: ${{ matrix.org }}