This commit is contained in:
39
.gitea/workflows/deploy.yaml
Normal file
39
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Deployment
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Deploy via SSH
|
||||||
|
uses: appleboy/ssh-action@v0.1.10
|
||||||
|
with:
|
||||||
|
host: 172.17.0.1
|
||||||
|
username: root
|
||||||
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
# Wir übergeben die Secrets als Environment-Variablen an den SSH-Befehl
|
||||||
|
envs: DB_USER,DB_PASSWORD
|
||||||
|
script: |
|
||||||
|
mkdir -p /root/iac
|
||||||
|
cd /root/iac
|
||||||
|
|
||||||
|
# Repository aktualisieren
|
||||||
|
if [ ! -d ".git" ]; then
|
||||||
|
git clone https://git.bana.space/krumbelfix/iac.git .
|
||||||
|
else
|
||||||
|
git pull origin main
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "hcloud_token = "${hetzner_token}" >> ./hetzner/terraform.tfvars
|
||||||
|
|
||||||
|
# Docker Container neu bauen und starten
|
||||||
|
terraform plan
|
||||||
|
terraform apply
|
||||||
|
|
||||||
|
echo "Deployment sucessfull"
|
||||||
|
env:
|
||||||
|
DB_USER: ${{ secrets.DB_USER }}
|
||||||
|
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||||
Reference in New Issue
Block a user