Skip to content

Commit 7ff97c9

Browse files
Update release.yaml
1 parent ccdef87 commit 7ff97c9

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/release.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,86 @@ jobs:
2626
with:
2727
creds: ${{ secrets.AZURE_CREDENTIALS }}
2828

29+
name: Build and Deploy Node.js Backend
30+
31+
on:
32+
push:
33+
branches: [dev, fix/creating-course-files-on-azure]
34+
pull_request:
35+
branches: [dev]
36+
37+
env:
38+
SERVICE_NAME: coursecreator
39+
NAMESPACE: ostronaut
40+
CLUSTER_NAME: ostronaut-aks
41+
resource_group: OstronautZDRG
42+
AZURE_LOGIN_SERVER: zopdev3462cd69a7c.azurecr.io
43+
44+
jobs:
45+
dockerize:
46+
runs-on: ubuntu-latest
47+
name: 🐳 Dockerize
48+
49+
outputs:
50+
image: ${{ steps.output-image.outputs.image }}
51+
52+
steps:
53+
- name: Checkout Code
54+
uses: actions/checkout@v4
55+
56+
- name: Log in to Azure
57+
uses: azure/login@v2
58+
with:
59+
creds: ${{ secrets.AZURE_CREDENTIALS }}
60+
61+
- name: Log in to ACR
62+
uses: azure/docker-login@v2
63+
with:
64+
login-server: ${{ env.AZURE_LOGIN_SERVER }}
65+
username: ${{ secrets.SVC_PRI_USERNAME }}
66+
password: ${{ secrets.SVC_PRI_PASSWORD }}
67+
68+
- name: Build and Push Docker image
69+
id: docker-build
70+
uses: docker/build-push-action@v5
71+
with:
72+
context: .
73+
push: true
74+
tags: |
75+
${{ env.AZURE_LOGIN_SERVER }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
76+
${{ env.AZURE_LOGIN_SERVER }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:latest
77+
78+
- name: Set output image
79+
id: output-image
80+
run: echo "image=${{ env.AZURE_LOGIN_SERVER }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}" >> $GITHUB_OUTPUT
81+
82+
deploy:
83+
needs: dockerize
84+
runs-on: ubuntu-latest
85+
name: 🚀 Deploy
86+
87+
steps:
88+
- name: Checkout Code
89+
uses: actions/checkout@v4
90+
91+
- name: Log in to Azure
92+
uses: azure/login@v2
93+
with:
94+
creds: ${{ secrets.AZURE_CREDENTIALS }}
95+
2996
- name: Set AKS context
97+
id: set-context
3098
uses: azure/aks-set-context@v3
3199
with:
32100
resource-group: ${{ env.resource_group }}
33101
cluster-name: ${{ env.CLUSTER_NAME }}
102+
admin: true
103+
104+
- name: Setup kubectl
105+
uses: azure/setup-kubectl@v3
106+
107+
- name: Deploy to AKS
108+
run: kubectl set image deployment/${{ env.SERVICE_NAME }} ${{ env.SERVICE_NAME }}=${{ needs.dockerize.outputs.image }} --namespace ${{ env.NAMESPACE }}
34109

35110
- name: Setup kubectl
36111
uses: azure/setup-kubectl@v3

0 commit comments

Comments
 (0)