Files
marco 31232ec925
Deploy static site / deploy (push) Successful in 1m12s
changed workflow to build the files during deploy action
2026-04-23 14:28:05 +02:00

58 lines
1.6 KiB
YAML

name: Deploy static site
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip install pyyaml
- name: Build site
run: python build.py
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Test SSH connection
run: |
ssh -i ~/.ssh/id_ed25519 \
-p ${{ secrets.DEPLOY_PORT }} \
-o StrictHostKeyChecking=yes \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"echo SSH connection successful"
- name: Ensure remote directory exists
run: |
ssh -i ~/.ssh/id_ed25519 \
-p ${{ secrets.DEPLOY_PORT }} \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"mkdir -p ${{ secrets.DEPLOY_PATH }}"
- name: Deploy via rsync
run: |
rsync -avz --delete \
-e "ssh -i ~/.ssh/id_ed25519 -p ${{ secrets.DEPLOY_PORT }} -o UpdateHostKeys=no" \
public/ \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}