Deploy mocks #2

Merged
stne3960 merged 3 commits from deploy-mocks into main 2025-05-22 00:43:52 +02:00
Showing only changes of commit 2e13456b24 - Show all commits

54
.github/workflows/deploy-mocks.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Deploy Mocks to Server
on:
push:
jobs:
upload-mocks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Detect changes in mocks/
id: changes
run: |
git fetch --all --prune --unshallow || true
git log --oneline -n 5 || true
echo "Checking for changes in mocks/..."
CHANGED=$(git diff --name-status origin/main...HEAD || true)
echo "Full diff output:"
echo "$CHANGED"
MOCK_CHANGED=$(echo "$CHANGED" | grep -E '^[AMD]\s+mocks/' || true)
echo "Detected changes in mocks/:"
echo "$MOCK_CHANGED"
{
echo "changed_files<<EOF"
echo "$MOCK_CHANGED"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Show changed_files output
run: echo "changed_files = '${{ steps.changes.outputs.changed_files }}'"
- name: Install rsync
run: |
sudo apt-get update
sudo apt-get install -y rsync
- name: Upload mocks via SSH
if: steps.changes.outputs.changed_files != ''
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_KEY: ${{ secrets.MOCKER_AT_APIMPOSTER }}
run: |
echo "$SSH_KEY" > gitea_key.pem
chmod 600 gitea_key.pem
rsync -avz --delete --no-perms --no-times \
-e "ssh -i gitea_key.pem -o StrictHostKeyChecking=no" \
mocks/ $SSH_HOST:/data0/mocks/