Move production deployment config to GitHub workflows #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to VPS | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install SSH key | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | |
- name: Deploy to server | |
run: | | |
ssh -o StrictHostKeyChecking=no deploy@195.200.15.145 << 'EOF' | |
cd /var/www/porotein | |
git pull | |
cd /var/www/porotein/app | |
pnpm install | |
pnpm build | |
cd /var/www/porotein/api | |
pnpm install | |
pnpm build | |
pm2 restart api | |
sudo systemctl reload nginx | |
EOF |