Initial: Hugo + Terraform Staging/Production Pipeline

This commit is contained in:
2026-05-06 18:02:41 +00:00
commit 3e61e70f36
12 changed files with 255 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
name: Deploy Production
on:
push:
tags:
- "v*"
jobs:
production:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: SSH Key einrichten
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.PROD_HOST_KEY }}" >> ~/.ssh/known_hosts
- name: Hugo Build
run: hugo --minify --source ./hugo
- name: Deploy auf Production
run: |
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no" \
./hugo/public/ \
root@${{ secrets.PROD_IP }}:/var/www/html/
+47
View File
@@ -0,0 +1,47 @@
name: Deploy Staging
on:
push:
branches:
- main
jobs:
staging:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Terraform Init & Apply (Staging LXC)
working-directory: terraform
run: |
terraform init
terraform apply -auto-approve \
-var="proxmox_host=${{ secrets.PROXMOX_HOST }}" \
-var="proxmox_token_id=${{ secrets.PROXMOX_TOKEN_ID }}" \
-var="proxmox_token_secret=${{ secrets.PROXMOX_TOKEN_SECRET }}" \
-var="proxmox_node=${{ secrets.PROXMOX_NODE }}" \
-var="staging_ip=${{ secrets.STAGING_IP }}" \
-var="staging_gw=${{ secrets.STAGING_GW }}" \
-var="ssh_public_key=${{ secrets.DEPLOY_SSH_PUBKEY }}"
env:
TF_IN_AUTOMATION: "true"
- name: SSH Key einrichten
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.STAGING_HOST_KEY }}" >> ~/.ssh/known_hosts
- name: Hugo Build
run: hugo --minify --source ./hugo
- name: Deploy auf Staging
run: |
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no" \
./hugo/public/ \
root@${{ secrets.STAGING_IP_PLAIN }}:/var/www/html/