testing
iwanhae committed
Nov 16, 2025 at 21:48 UTC
826ef1ce7e2bcd54bb55d90ed5df03cd03529b84
1 file changed
+41
.github/workflows/cd.yml
+41
@@ -62,3 +62,44 @@ jobs:
62
push: true
63
tags: ${{ steps.meta.outputs.tags }}
64
labels: ${{ steps.meta.outputs.labels }}
65
+ deploy:
66
+ name: Deploy
67
+ runs-on: ubuntu-latest
68
+ needs: build-and-push
69
+ environment: "kubernetes_iwanhae_kr"
70
+ steps:
71
+ - name: Checkout code
72
+ uses: actions/checkout@v5
73
+
74
+ - uses: azure/setup-kubectl@v4
75
+ with:
76
+ version: "1.33"
77
+
78
+ - name: Prepare Kubernetes context
79
+ run: |
80
+ kubectl config set-cluster default --server ${{ secrets.KUBERNETES_ENDPOINT }}
81
+ kubectl config set-credentials default --token ${{ secrets.KUBERNETES_TOKEN }}
82
+ kubectl config set-context default --cluster=default --user=default --namespace=${{ env.KUBERNETES_NAMESPACE }}
83
+ kubectl config use-context default
84
+ kubectl version
85
+
86
+ - name: Get Container Image Tag from metadata action
87
+ uses: docker/metadata-action@v5
88
+ with:
89
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
90
+ tags: type=sha,enable=true,prefix=sha-,suffix=,format=short
91
+ id: meta
92
+
93
+ - name: Deploy to Kubernetes
94
+ run: kubectl set image deployments.apps/portal portal="${{ steps.meta.outputs.tags }}"
95
+
96
+ - name: Wait for Deployment to be Ready
97
+ run: kubectl rollout status deployment/portal --timeout=1m
98
+ timeout-minutes: 1
99
+ continue-on-error: true
100
+
101
+ - name: Rollback Deployment
102
+ if: failure()
103
+ run: |-
104
+ kubectl rollout undo deployment/portal
105
+ exit 1