diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 67e977a..d87970e 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -18,19 +18,29 @@ on: jobs: build_and_deploy: runs-on: linux - container: - image: ubuntu:latest - options: --entrypoint /bin/sh steps: - - name: Install tools + - name: Setup SSH for git/scp/rsync + shell: bash run: | - apt-get update - apt-get install -y bash git openssh-client rsync podman-cli + install -m 700 -d ~/.ssh + printf "%s\n" "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + printf "%s\n" "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + chmod 644 ~/.ssh/known_hosts + git config --global url."ssh://git@gitea.smb-corp.de".insteadOf "https://gitea.smb-corp.de" + - name: Checkout repository run: git clone git@gitea.smb-corp.de:${{ gitea.repository }} . - - name: Deploy via SSH + - name: Deploy via SSH (rsync or scp fallback) + shell: bash run: | - rsync -az --delete ./ $TARGET_USER@$TARGET_HOST:$APP_DIR/ + if command -v rsync >/dev/null 2>&1; then + rsync -az --delete ./ $TARGET_USER@$TARGET_HOST:$APP_DIR/ + else + echo "rsync not found, falling back to scp -r (no delete sync)" + ssh $TARGET_USER@$TARGET_HOST "mkdir -p $APP_DIR" + scp -r ./ $TARGET_USER@$TARGET_HOST:$APP_DIR/ + fi # - name: Checkout repository from local Gitea # run: | # git clone http://gitea:3000/${{ gitea.repository }} .