Some checks failed
Build and Deploy to k3s (Production) / build-and-deploy (push) Failing after 3m15s
Remove base64 decoding from kubeconfig setup step. Now accepts KUBE_CONFIG secret as plain text directly instead of base64 encoded. This simplifies secret configuration in Gitea UI - users can paste kubeconfig content directly without requiring base64 encoding. Changes: - deploy-prod.yml: Remove 'base64 -d' from kubeconfig setup - deploy-alpha.yml: Remove 'base64 -d' from kubeconfig setup Secret Configuration: Old: KUBE_CONFIG should be base64 encoded New: KUBE_CONFIG should be plain text kubeconfig content 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
82 lines
2.7 KiB
YAML
82 lines
2.7 KiB
YAML
name: Build and Deploy to k3s (Alpha)
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'PRE_ALPHA*'
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
env:
|
|
KUBECONFIG: ~/.kube/config
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Next.js app
|
|
run: npm run build
|
|
env:
|
|
NEXT_PUBLIC_API_URL: ${{ secrets.ALPHA_API_URL }}
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build \
|
|
-t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend-alpha:${{ github.sha }} \
|
|
-t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend-alpha:latest \
|
|
--build-arg NODE_ENV=production \
|
|
.
|
|
|
|
- name: Login to Container Registry
|
|
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
|
|
- name: Push Docker images
|
|
run: |
|
|
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend-alpha:${{ github.sha }}
|
|
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend-alpha:latest
|
|
|
|
- name: Setup kubectl
|
|
uses: azure/setup-kubectl@v3
|
|
with:
|
|
version: 'latest'
|
|
|
|
- name: Configure kubectl
|
|
run: |
|
|
mkdir -p ~/.kube
|
|
echo "${{ secrets.KUBE_CONFIG }}" > ~/.kube/config
|
|
chmod 600 ~/.kube/config
|
|
|
|
- name: Validate kubeconfig and cluster connectivity
|
|
run: |
|
|
if ! kubectl version --client; then
|
|
echo "❌ Failed to get kubectl version"
|
|
exit 1
|
|
fi
|
|
if ! kubectl cluster-info --kubeconfig ~/.kube/config > /dev/null 2>&1; then
|
|
echo "❌ Failed to connect to cluster"
|
|
exit 1
|
|
fi
|
|
echo "✅ Successfully connected to Kubernetes cluster"
|
|
|
|
- name: Deploy to Alpha (k3s)
|
|
run: |
|
|
echo "Applying Kubernetes manifests..."
|
|
kubectl apply -k deploy/k3s/alpha --kubeconfig ~/.kube/config
|
|
|
|
echo "Updating deployment image..."
|
|
kubectl set image deployment/hosting-frontend \
|
|
hosting-frontend=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend-alpha:${{ github.sha }} \
|
|
-n hosting-alpha --kubeconfig ~/.kube/config
|
|
|
|
echo "Waiting for rollout to complete..."
|
|
kubectl rollout status deployment/hosting-frontend -n hosting-alpha --kubeconfig ~/.kube/config --timeout=5m
|
|
|
|
echo "✅ Alpha deployment complete!"
|