forked from BLC/sgeUpdated
Some checks failed
sgeUpdated CI/CD / deploy (pull_request) Failing after 10m33s
30 lines
881 B
YAML
30 lines
881 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: |
|
|
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
|
|
echo "✅ PR merged into main — running deploy script.."
|
|
cd /home/ubuntu/Bgreen/sgeUpdated
|
|
./deploy.sh
|
|
EOF
|