84 lines
2.6 KiB
YAML
84 lines
2.6 KiB
YAML
name: Apply Kuberentes Configs
|
|
on: [push, workflow_dispatch]
|
|
jobs:
|
|
update-repo:
|
|
uses: ./.gitea/workflows/update-repo.yml
|
|
runs-on: home-server
|
|
update-infrastructure:
|
|
runs-on: home-server
|
|
needs: update-repo-folder
|
|
env:
|
|
KUBECONFIG: /home/gitea-runner/.kube/config
|
|
defaults:
|
|
run:
|
|
working-directory: /home/gitea-runner/infrastructure
|
|
steps:
|
|
- name: update home server containers
|
|
run: |
|
|
kubectl apply -f kubernetes/proxy-ingress
|
|
|
|
kubectl annotate ingressclass nginx \
|
|
ingressclass.kubernetes.io/is-default-class="true" --overwrite
|
|
|
|
- name: audiobookshelf
|
|
run: |
|
|
kubectl apply -f kubernetes/audiobookshelf/
|
|
|
|
- name: home assistant
|
|
run: |
|
|
kubectl apply -f kubernetes/homeassistant/
|
|
|
|
- name: copilot
|
|
run: |
|
|
kubectl create secret generic copilot-secret \
|
|
-n copilot \
|
|
--from-literal=token=${{ secrets.COPILOT_SECRET }} \
|
|
--dry-run=client -o yaml | kubectl apply -f -
|
|
|
|
kubectl apply -f kubernetes/copilot/
|
|
|
|
- name: jellyfin
|
|
run: |
|
|
kubectl apply -f kubernetes/jellyfin/
|
|
|
|
- name: minecraft
|
|
run: |
|
|
kubectl apply -f kubernetes/minecraft/
|
|
|
|
- name: homepage
|
|
run: |
|
|
kubectl apply -f kubernetes/homepage/
|
|
kubectl rollout restart deployment/homepage -n homepage
|
|
|
|
- name: gitea
|
|
env:
|
|
CLOUDFLARED_GITEA_TOKEN: ${{ secrets.CLOUDFLARED_GITEA_TOKEN }}
|
|
run: |
|
|
kubectl apply -f kubernetes/gitea/namespace.yml
|
|
kubectl create configmap gitea-landing-page \
|
|
-n gitea \
|
|
--from-file=home.tmpl=kubernetes/gitea/landingpage.html \
|
|
--from-file=custom-landing.css=kubernetes/gitea/landingpage.css \
|
|
--from-file=custom-landing.js=kubernetes/gitea/landingpage.js \
|
|
--dry-run=client -o yaml | kubectl apply -f -
|
|
|
|
for file in kubernetes/gitea/*.yml; do
|
|
cat "$file" | envsubst | kubectl apply -f -
|
|
done
|
|
|
|
kubectl rollout restart deployment/gitea-web -n gitea
|
|
|
|
notify-on-failure:
|
|
runs-on: home-server
|
|
needs: update-infrastructure
|
|
if: failure()
|
|
uses: ./.gitea/workflows/notify-ntfy.yml
|
|
secrets:
|
|
NTFY_CHANNEL: ${{ secrets.NTFY_CHANNEL }}
|
|
with:
|
|
title: "Kubernetes Apply Failed"
|
|
message: |
|
|
Failed to apply kubernetes configs
|
|
action_url: "https://git.alexmickelson.guru/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }}"
|
|
priority: "high"
|
|
tags: "rotating_light,kubernetes" |