Files
elixirAI/.gitea/workflows/pipeline.yml
Alex Mickelson 25be2e5210
All checks were successful
CI/CD Pipeline / build (push) Successful in 11s
db startup
2026-03-09 15:12:10 -06:00

53 lines
1.6 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: home-server
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
clean: false
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push backend image
run: |
docker build -t alexmickelson/ai-liveview:$GITHUB_RUN_NUMBER .
docker push -q alexmickelson/ai-liveview:$GITHUB_RUN_NUMBER
- name: Deploy to Kubernetes
env:
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG_CONTENT }}
AI_TOKEN: ${{ secrets.AI_TOKEN }}
run: |
echo "$KUBECONFIG_CONTENT" > /tmp/elixir-kubeconfig.yml
export KUBECONFIG=/tmp/elixir-kubeconfig.yml
kubectl create namespace ai-ha-elixir --dry-run=client -o yaml | kubectl apply -f -
kubectl get secret ai-ha-elixir-secrets --namespace ai-ha-elixir || \
kubectl create secret generic ai-ha-elixir-secrets \
--namespace ai-ha-elixir \
--from-literal=SECRET_KEY_BASE=$(openssl rand -hex 64) \
--from-literal=AI_TOKEN="$AI_TOKEN"
kubectl create configmap db-schema \
--from-file=schema.sql=schema.sql \
--namespace ai-ha-elixir \
--dry-run=client -o yaml | kubectl apply -f -
for file in kubernetes/*.yml; do
cat "$file" | envsubst | kubectl apply -f -
done