name: Subsonics Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      
    - name: Update and upgrade server
      run: |
        ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null raphix@raphix.fr sudo apt update -y
        ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null raphix@raphix.fr sudo apt upgrade -y

    - name: Run deployment script
      run: ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null raphix@raphix.fr sudo -S -u gitlab-ci /home/gitlab-ci/subsonics_deploy.sh
