Files
rustycms/.gitea/workflows/deploy.yml
Peter Meier c644c08222
All checks were successful
Deploy to Server / deploy (push) Successful in 20s
Generate .env on server from Gitea secrets during deploy
2026-03-15 14:55:45 +01:00

48 lines
1.5 KiB
YAML

name: Deploy to Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build API image
run: |
docker build -t rustycms-api:latest .
- name: Build Admin UI image
run: |
docker build \
--build-arg NEXT_PUBLIC_RUSTYCMS_API_URL=https://cms.pm86.de \
-t rustycms-admin:latest \
./admin-ui
- name: Deploy
run: |
apt-get update -qq && apt-get install -y rsync
echo "${{ secrets.SSH_DEPLOY_KEY }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
SSH="ssh -o StrictHostKeyChecking=no -i /tmp/deploy_key root@167.86.74.105"
# .env aus Secrets generieren
$SSH "cat > /opt/rustycms/.env" << 'ENVEOF'
RUSTYCMS_API_KEY=${{ secrets.RUSTYCMS_API_KEY }}
RUSTYCMS_BASE_URL=${{ secrets.RUSTYCMS_BASE_URL }}
RUSTYCMS_CORS_ORIGIN=${{ secrets.RUSTYCMS_CORS_ORIGIN }}
RUSTYCMS_LOCALES=${{ secrets.RUSTYCMS_LOCALES }}
RUSTYCMS_CACHE_TTL_SECS=${{ secrets.RUSTYCMS_CACHE_TTL_SECS }}
RUSTYCMS_STORE=${{ secrets.RUSTYCMS_STORE }}
ENVEOF
rsync -avz --delete \
-e "ssh -o StrictHostKeyChecking=no -i /tmp/deploy_key" \
./types/ root@167.86.74.105:/opt/rustycms/types/
$SSH "docker compose -f /opt/rustycms/docker-compose.yml up -d && docker image prune -f"
rm /tmp/deploy_key