avisenna-landing-page/.github/workflows/deploy.yaml
Workflow config file is invalid. Please check your config file: yaml: line 21: mapping values are not allowed in this context
2025-04-11 18:32:33 +00:00

53 lines
1.4 KiB
YAML

# .github/workflows/deploy.yaml
name: Build and Deploy to Kubernetes
#on:
# push:
# branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Debug Variables
run: echo "Repository: ${{ github.repository }}"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
IMAGE_NAME="ghcr.io/${{ github.repository }}"
docker build -t "$IMAGE_NAME:latest" .
docker push "$IMAGE_NAME:latest"
shell: bash
- name: Set up Kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config
- name: Deploy to Kubernetes
run: |
kubectl set image deployment/homepage homepage=ghcr.io/${{ github.repository }}:latest -n web
- name: Set up kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config
env:
KUBECONFIG: ~/.kube/config