Files
testRepo/.gitea/workflows/deploy-my-vpn.yml
Alexander Sergeevich 5e7dc3be49
All checks were successful
Deploy to my-vpn / deploy (push) Successful in 34s
add jq smoke check with retry
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 01:35:56 +03:00

51 lines
1.8 KiB
YAML

name: Deploy to my-vpn
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Unit tests
run: |
python3 -m unittest discover -s tests
- name: Install jq
run: |
apt-get update -y
apt-get install -y jq
- name: Deploy via SSH
env:
VPN_HOST: ${{ secrets.VPN_HOST }}
VPN_USER: ${{ secrets.VPN_USER }}
VPN_SSH_KEY: ${{ secrets.TEST_KEY }}
run: |
set -euo pipefail
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s' "$VPN_SSH_KEY" > ~/.ssh/id_ci_runner
chmod 600 ~/.ssh/id_ci_runner
VPN_USER="$(printf '%s' "$VPN_USER" | tr -d '\r\n')"
VPN_HOST="$(printf '%s' "$VPN_HOST" | tr -d '\r\n')"
echo "using user=${VPN_USER} host=${VPN_HOST}"
ssh-keyscan -H "$VPN_HOST" >> ~/.ssh/known_hosts || true
ssh-keygen -lf ~/.ssh/id_ci_runner
ssh -o BatchMode=yes -o ConnectTimeout=10 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ci_runner "${VPN_USER}@${VPN_HOST}" "echo ok"
ssh -o BatchMode=yes -o ConnectTimeout=10 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ci_runner "${VPN_USER}@${VPN_HOST}" "cd /srv/ip-ua && git fetch --all && git reset --hard origin/main && bash deploy/my-vpn/deploy.sh"
for i in $(seq 1 10); do
if curl -fsS "http://${VPN_HOST}" -o /tmp/resp.json; then
break
fi
sleep 2
done
jq -e '.ip and .user_agent and .method and .path and .timestamp' /tmp/resp.json >/dev/null
echo "smoke ok"