Files
iac/.gitea/workflows/deploy.yaml
Melchior Reimers 9830875e36
Some checks failed
Deployment / deploy-docker (push) Failing after 16s
updated ci/cd
2026-02-04 19:33:46 +01:00

43 lines
1.2 KiB
YAML

name: Deployment
on:
push:
branches:
- main
jobs:
deploy-docker:
runs-on: ubuntu-latest
steps:
- name: Validate deployment secrets
env:
SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }}
HETZNER_TOKEN: ${{ secrets.HETZNER_TOKEN }}
run: |
set -e
if [ -z "$SSH_PUBLIC_KEY" ]; then
echo "Missing SSH_PUBLIC_KEY secret"
exit 1
fi
if [ -z "$HETZNER_TOKEN" ]; then
echo "Missing HETZNER_TOKEN secret"
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Deploy with Terraform
env:
HETZNER_TOKEN: ${{ secrets.HETZNER_TOKEN }}
SSH_KEY: ${{ secrets.SSH_PUBLIC_KEY }}
run: |
set -e
# Kopiere das Template und ersetze die Platzhalter mit sed
cp terraform.tfvars.example terraform.tfvars
sed -i "s|__HCLOUD_TOKEN__|${HETZNER_TOKEN}|g" terraform.tfvars
sed -i "s|__SSH_KEY__|${SSH_KEY}|g" terraform.tfvars
terraform init
terraform apply -auto-approve
echo "Deployment successful"