REFACTOR(ci): remove deploy workflow

- Remove deploy workflow
- ArgoCD handles deployment
This commit is contained in:
2025-11-23 10:19:18 +09:00
parent fa8d65d6da
commit 28f0d30cdb

View File

@@ -1,118 +0,0 @@
name: Deploy to Kubernetes
on:
workflow_run:
workflows: ["Build Docker Image"]
types:
- completed
branches: [main]
workflow_dispatch:
inputs:
image_tag:
description: 'Docker image tag to deploy (e.g., main-abc1234)'
required: false
default: 'latest'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
K8S_NAMESPACE: jovies
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Configure kubectl with Lightsail
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config
# Verify connection
kubectl cluster-info
kubectl get nodes
- name: Determine image tag
id: image
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
TAG="${{ github.event.inputs.image_tag }}"
else
# Use the commit SHA from the workflow_run event
TAG="main-$(echo ${{ github.sha }} | cut -c1-7)"
fi
# Convert repository name to lowercase for Docker
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
FULL_IMAGE="${{ env.REGISTRY }}/${REPO_LOWER}:${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "full_image=${FULL_IMAGE}" >> $GITHUB_OUTPUT
echo "🐳 Deploying image: ${FULL_IMAGE}"
- name: Create namespace if not exists
run: |
kubectl create namespace jovies --dry-run=client -o yaml | kubectl apply -f -
- name: Deploy to Kubernetes
run: |
echo "🚀 Applying Kubernetes manifests..."
kubectl apply -f deploy/k8s/ -n jovies
echo "🔄 Updating deployment image..."
kubectl set image deployment/jovies-app \
jovies-app=${{ steps.image.outputs.full_image }} \
-n jovies
kubectl patch deployment jovies-app \
-n jovies \
--type='json' \
-p='[{"op":"replace","path":"/spec/template/spec/containers/0/imagePullPolicy","value":"IfNotPresent"}]'
- name: Wait for rollout to complete
run: |
echo "⏳ Waiting for deployment rollout..."
kubectl rollout status deployment/jovies-app \
-n jovies \
--timeout=5m
- name: Verify deployment
run: |
echo "📊 Deployment status:"
kubectl get deployments -n jovies
echo ""
echo "🔍 Pod status:"
kubectl get pods -n jovies
echo ""
echo "🌐 Service status:"
kubectl get services -n jovies
- name: Get deployment info
run: |
echo "✅ Deployment completed!"
echo ""
echo "📦 Deployed image: ${{ steps.image.outputs.full_image }}"
echo "🏷️ Namespace: jovies"
echo ""
echo "🔗 Useful commands:"
echo " - View logs: kubectl logs -n jovies -l app=jovies-app -f"
echo " - Port forward: kubectl port-forward -n jovies deploy/jovies-app 3000:3000"
echo " - Rollback: kubectl rollout undo deployment/jovies-app -n jovies"
- name: Deployment failure notification
if: failure()
run: |
echo "❌ Deployment failed!"
echo "Check logs with: kubectl logs -n jovies -l app=jovies-app"
exit 1