Files
rustycms/.gitea/workflows/deploy.yml
Peter Meier 09981f5110
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
Add RUSTYCMS_ENVIRONMENTS to deploy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 22:32:11 +01:00

57 lines
1.9 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"
# API .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 }}
RUSTYCMS_ENVIRONMENTS=${{ secrets.RUSTYCMS_ENVIRONMENTS }}
ENVEOF
# Admin UI .env aus Secrets generieren
$SSH "cat > /opt/rustycms/.env.admin" << 'ENVEOF'
RUSTYCMS_API_KEY=${{ secrets.RUSTYCMS_API_KEY }}
ADMIN_USERNAME=${{ secrets.ADMIN_USERNAME }}
ADMIN_PASSWORD=${{ secrets.ADMIN_PASSWORD }}
SESSION_SECRET=${{ secrets.SESSION_SECRET }}
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