Files
sgeUpdated/.gitea/workflows/sgeupdated.yml
2026-03-10 12:11:40 +03:00

28 lines
940 B
YAML

name: sgeUpdated CI/CD
on:
pull_request:
types:
- closed # Fires when a PR is closed (either merged or manually closed)
branches:
- main # Only when PR targets main
jobs:
deploy:
if: github.event.pull_request.merged == true # Run only if the PR was merged (not just closed)
runs-on: ubuntu-latest
steps:
- name: Setup SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Run deploy script on server
run: |
# We add -tt to force a pseudo-terminal (fixes that stdin error)
# We call bash -lc to force a Login Shell, which loads your credentials
ssh -tt ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} "bash -lc 'cd /home/ubuntu/Bgreen/sgeUpdated && ./deploy.sh'"