Spaces:
Running
Running
| name: Deploy to Development | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup SSH Agent | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Configure SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| ssh-keyscan -4 -p 10022 -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts | |
| chmod 644 ~/.ssh/known_hosts | |
| - name: Test SSH Connection | |
| run: | | |
| ssh -p 10022 -o StrictHostKeyChecking=no capstone4@${{ secrets.VPS_HOST }} "echo SSH CONNECTED" | |
| - name: Push to VPS | |
| run: | | |
| git remote remove vps || true | |
| git remote add vps ssh://capstone4@${{ secrets.VPS_HOST }}:10022/home/capstone4/git/repos/backend-development.git | |
| git push vps HEAD:development --force | |