test local clone
Some checks failed
Build and Deploy Container / build_and_deploy (push) Has been cancelled

This commit is contained in:
Clemens Hering
2025-11-09 15:42:23 +01:00
parent 8bd5ed3e05
commit e09e0018b2

View File

@@ -18,19 +18,29 @@ on:
jobs: jobs:
build_and_deploy: build_and_deploy:
runs-on: linux runs-on: linux
container:
image: ubuntu:latest
options: --entrypoint /bin/sh
steps: steps:
- name: Install tools - name: Setup SSH for git/scp/rsync
shell: bash
run: | run: |
apt-get update install -m 700 -d ~/.ssh
apt-get install -y bash git openssh-client rsync podman-cli 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 - name: Checkout repository
run: git clone git@gitea.smb-corp.de:${{ gitea.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: | 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 # - name: Checkout repository from local Gitea
# run: | # run: |
# git clone http://gitea:3000/${{ gitea.repository }} . # git clone http://gitea:3000/${{ gitea.repository }} .