48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Build and Deploy Hugo
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: native
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --recurse-submodules https://git.alocoq.fr/alois/CoqBlog.git .
|
|
ls -la themes/
|
|
ls -la themes/PaperMod/
|
|
|
|
- name: Install Hugo
|
|
run: |
|
|
apk add --no-cache hugo git
|
|
hugo version
|
|
|
|
- name: Build
|
|
run: hugo --minify
|
|
|
|
- name: Install kubectl
|
|
run: |
|
|
wget -q https://dl.k8s.io/release/v1.31.0/bin/linux/amd64/kubectl
|
|
chmod +x kubectl
|
|
mv kubectl /usr/local/bin/kubectl
|
|
|
|
- name: Deploy
|
|
env:
|
|
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
|
|
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
|
|
run: |
|
|
kubectl config set-cluster homelab \
|
|
--server=${KUBE_SERVER} \
|
|
--insecure-skip-tls-verify=true
|
|
kubectl config set-credentials deployer \
|
|
--token=${KUBE_TOKEN}
|
|
kubectl config set-context homelab \
|
|
--cluster=homelab \
|
|
--user=deployer
|
|
kubectl config use-context homelab
|
|
POD=$(kubectl get pods -n blog -l app=hugo-nginx -o jsonpath='{.items[0].metadata.name}')
|
|
kubectl cp public/. blog/${POD}:/usr/share/nginx/html/
|
|
|