Files
Webseite_Stines/.gitea/workflows/staging.yml
T

48 lines
1.4 KiB
YAML

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/