Skip to content

Commit 1d662f8

Browse files
feat: update cicd to deploy split into k8s (#1576)
Co-authored-by: joaosousa <j.sousa@xgeeks.com>
1 parent f76463d commit 1d662f8

File tree

2 files changed

+39
-54
lines changed

2 files changed

+39
-54
lines changed

.github/workflows/deploy_backend_frontend.yml

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,58 +28,30 @@ jobs:
2828
ROOT: ./frontend
2929
secrets: inherit
3030

31-
deploy_backend_dev:
32-
name: Deploy backend DEV
33-
needs: build_backend
34-
uses: ./.github/workflows/on_call_deploy.yaml
35-
with:
36-
ENVIRONMENT: dev
37-
APP_NAME: split-be-dev
38-
REPOSITORY: backend
39-
secrets:
40-
PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }}
41-
42-
deploy_frontend_dev:
43-
name: Deploy frontend DEV
44-
needs: build_frontend
31+
deploy_dev:
32+
name: Deploy DEV
33+
needs:
34+
- build_backend
35+
- build_frontend
4536
uses: ./.github/workflows/on_call_deploy.yaml
4637
with:
4738
ENVIRONMENT: dev
48-
APP_NAME: split-fe-dev
49-
REPOSITORY: frontend
50-
secrets:
51-
PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }}
39+
CHART_OVERRIDE_PATH: './infrastructure/values/development.yaml'
5240

53-
deploy_backend_prod:
54-
name: Deploy backend PROD
55-
needs: deploy_backend_dev
41+
deploy_prod:
42+
name: Deploy PROD
43+
needs: deploy_dev
5644
uses: ./.github/workflows/on_call_deploy.yaml
5745
with:
5846
ENVIRONMENT: prod
59-
APP_NAME: split-be
60-
REPOSITORY: backend
61-
secrets:
62-
PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }}
63-
64-
deploy_frontend_prod:
65-
name: Deploy frontend PROD
66-
needs: deploy_frontend_dev
67-
uses: ./.github/workflows/on_call_deploy.yaml
68-
with:
69-
ENVIRONMENT: prod
70-
APP_NAME: split-fe
71-
REPOSITORY: frontend
72-
secrets:
73-
PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }}
47+
CHART_OVERRIDE_PATH: './infrastructure/values/production.yaml'
7448

7549
pre_release:
7650
name: Create Pre Release
7751
runs-on: ubuntu-latest
7852
permissions:
7953
contents: write
80-
needs:
81-
- deploy_backend_dev
82-
- deploy_frontend_dev
54+
needs: deploy_dev
8355
steps:
8456
- name: Update release draft
8557
uses: release-drafter/release-drafter@v6
@@ -93,9 +65,7 @@ jobs:
9365
runs-on: ubuntu-latest
9466
permissions:
9567
contents: write
96-
needs:
97-
- deploy_backend_prod
98-
- deploy_frontend_prod
68+
needs: deploy_prod
9969
steps:
10070
- name: Update release draft
10171
uses: release-drafter/release-drafter@v6

.github/workflows/on_call_deploy.yaml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,41 @@ on:
66
ENVIRONMENT:
77
required: true
88
type: string
9-
APP_NAME:
9+
CHART_OVERRIDE_PATH:
1010
required: true
1111
type: string
12-
REPOSITORY:
13-
required: true
14-
type: string
15-
secrets:
16-
PUBLISH_PROFILE:
17-
required: true
1812

1913
env:
2014
TAG: ${{ github.sha }}
15+
CHART-PATH: './infrastructure/split'
2116

2217
jobs:
2318
deploy:
2419
runs-on: ubuntu-latest
25-
environment: ${{ inputs.ENVIRONMENT }}
2620
steps:
27-
- uses: azure/webapps-deploy@v3
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: "check is AZURE_CREDENTIALS exists"
25+
env:
26+
super_secret: ${{ secrets.AZURE_CREDENTIALS }}
27+
if: ${{ env.super_secret == '' }}
28+
run: 'echo "echo the secret \"AZURE_CREDENTIALS\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"'
29+
30+
- name: Azure login
31+
uses: azure/#@v2
2832
with:
29-
app-name: ${{ inputs.APP_NAME }}
30-
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
31-
images: split.azurecr.io/${{ inputs.REPOSITORY }}:${{ env.TAG }}
33+
creds: ${{ secrets.AZURE_CREDENTIALS }}
34+
35+
- name: Set AKS context
36+
uses: azure/aks-set-context@v4
37+
with:
38+
resource-group: '${{ secrets.RESOURCE_GROUP }}'
39+
cluster-name: '${{ secrets.CLUSTER_NAME }}'
40+
41+
- name: Install Helm
42+
uses: azure/setup-helm@v4.2.0
43+
44+
- name: Deploy
45+
#environment: ${{ inputs.ENVIRONMENT }}
46+
run: helm upgrade --install split ${{ env.CHART-PATH }} -f ${{ inputs.CHART_OVERRIDE_PATH }} --set global.image.tag=${{ env.TAG }} --namespace=split-${{ inputs.ENVIRONMENT }} --create-namespace --atomic

0 commit comments

Comments
 (0)