diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..64931b7 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Deploy + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + deploy: + runs-on: fedora:latest + steps: + - uses: actions/checkout@v4 + + - name: Install deployment tools + run: | + dnf install -y sshpass rsync + + - name: Generate SHA256SUMS + run: sha256sum *.py > SHA256SUMS + + - name: Deploy via rsync + timeout-minutes: 3 + env: + DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} + DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }} + run: | + set -euo pipefail + echo "Deploying to ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}" + + sshpass -p "$DEPLOY_PASSWORD" rsync -avz --delete \ + -e "ssh -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/dev/null" \ + *.py SHA256SUMS "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}" + + echo "Deploy complete."