Merge pull request #3 from Muimi-Chat/staging #6
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 School VM | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
jobs: | |
deploy: | |
if: github.event.pull_request.merged == true || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.VM_SSH_KEY }} | |
- name: Deploy via SSH | |
env: | |
VM_IP: ${{ secrets.VM_IP }} | |
VM_USER: ${{ secrets.VM_USER }} | |
run: | | |
ssh -o StrictHostKeyChecking=no $VM_USER@$VM_IP ' | |
cd GITLOCAL/chat-service/ && \ | |
git pull && \ | |
docker compose down && \ | |
docker compose -f docker-compose-prod.yml up -d | |
' |