Files
valtrix-website/.gitea/workflows/deploy.yaml
Clemens Hering a6da3566d0
Some checks failed
Build and Deploy Container / build_and_deploy (push) Has been cancelled
Chaned fixed values to variables
2025-11-08 15:08:54 +01:00

48 lines
1.3 KiB
YAML

name: Build and Deploy Container
env:
TARGET_HOST: www.valtrix.systems
TARGET_USER: traefik
APP_DIR: /home/traefik/app
CONTAINER_NAME: valtrix-website
QUADLET_FILE: valtrix-website.container
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
on:
push:
branches:
- main
- develop
jobs:
build_and_deploy:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Copy code to target host
run: |
rsync -az --delete ./ $TARGET_USER@$TARGET_HOST:$APP_DIR/
- name: Build container on target host
run: |
ssh $TARGET_USER@$TARGET_HOST '
cd $APP_DIR
podman build -t $CONTAINER_NAME:latest .
'
- name: Backup Quadlet file
run: |
ssh $TARGET_USER@$TARGET_HOST '
cp ~/.config/containers/systemd/$CONTAINER_NAME.container ~/.config/containers/systemd/$CONTAINER_NAME.container.bak
'
- name: Replace Quadlet file
run: |
scp ./$QUADLET_FILE $TARGET_USER@$TARGET_HOST:~/.config/containers/systemd/
ssh $TARGET_USER@$TARGET_HOST '
systemctl --user daemon-reload
systemctl --user restart $CONTAINER_NAME.service
'