2024-07-12 22:20:48 +00:00
|
|
|
name: Deploy to server
|
|
|
|
|
2024-07-12 22:11:26 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
2024-07-12 21:52:48 +00:00
|
|
|
jobs:
|
2024-07-12 22:20:48 +00:00
|
|
|
deploy:
|
2024-07-12 21:52:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-07-12 22:20:48 +00:00
|
|
|
|
2024-07-12 21:52:48 +00:00
|
|
|
steps:
|
2024-07-12 22:20:48 +00:00
|
|
|
- name: Checkout Repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Configure SSH
|
|
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
|
|
|
|
|
|
|
|
- name: Git Pull
|
|
|
|
run: |
|
|
|
|
cd ${{ github.workspace }}
|
|
|
|
ssh-keyscan -t rsa ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
|
|
|
|
ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "cd ${{ secrets.REPO_PATH }} && git pull origin main"
|
|
|
|
echo "Successfully pulled repo."
|