ci(andreknie.de): add Gitea Actions deploy
Deploy andreknie.de / deploy (push) Canceled after 0s

This commit is contained in:
2026-07-27 16:20:43 +02:00
parent 18a911cd4e
commit a68f854aa2
+72
View File
@@ -0,0 +1,72 @@
name: Deploy andreknie.de
on:
push:
branches:
- feat/federation-setup
paths:
- ".gitea/workflows/deploy-andreknie.yml"
- "privat/CV/andreknie.de/**"
jobs:
deploy:
runs-on: ubuntu-latest
container:
image: node:20-bookworm
env:
DEPLOY_HOST: "217.160.174.2"
DEPLOY_USER: "root"
DEPLOY_PATH: "/opt/andreknie"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install deploy tools
run: |
apt-get update -qq
apt-get install -y openssh-client rsync
- name: Build frontend
run: |
cd privat/CV/andreknie.de
npm ci
npm run build
- name: Configure SSH
env:
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
run: |
install -d -m 700 ~/.ssh
printf '%s\n' "$VPS_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "$DEPLOY_HOST" > ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
- name: Write production environment
working-directory: privat/CV/andreknie.de
env:
SMTP_HOST: ${{ secrets.SMTP_HOST }}
SMTP_USER: ${{ secrets.SMTP_USER }}
SMTP_PASS: ${{ secrets.SMTP_PASS }}
run: |
cat > .env <<EOF
PORT=3003
NODE_ENV=production
BASE_URL=https://andreknie.de
SMTP_HOST=$SMTP_HOST
SMTP_PORT=587
SMTP_USER=$SMTP_USER
SMTP_PASS=$SMTP_PASS
STAKEHOLDER_EMAIL=kontakt@d-hive.de
EOF
- name: Deploy to VPS
working-directory: privat/CV/andreknie.de
run: |
SSH_OPTS="-i ~/.ssh/deploy_key -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
ssh $SSH_OPTS "${DEPLOY_USER}@${DEPLOY_HOST}" "install -d -m 755 ${DEPLOY_PATH}/site ${DEPLOY_PATH}/server ${DEPLOY_PATH}/server/data"
rsync -az --delete -e "ssh $SSH_OPTS" dist/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/site/"
rsync -az --delete -e "ssh $SSH_OPTS" server/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/server/"
rsync -az -e "ssh $SSH_OPTS" package.json package-lock.json Dockerfile docker-compose.yml Caddyfile .env "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/"
ssh $SSH_OPTS "${DEPLOY_USER}@${DEPLOY_HOST}" "cd ${DEPLOY_PATH} && docker compose up -d --build"
ssh $SSH_OPTS "${DEPLOY_USER}@${DEPLOY_HOST}" "if command -v caddy >/dev/null 2>&1; then caddy validate --config /etc/caddy/Caddyfile && systemctl reload caddy; fi"