# ce job permet le déploiement en production à la demande

name: ondemand_CD-PRODUCTION

# ce job s’execute à la demande pour le déploiement en production  
on:
  # ondemand job
  workflow_dispatch:

jobs:
  # un seul job "deployment"
  deployment:
    # définir le runner
    runs-on: ubuntu-latest
    environment: production
    env: 
      SSHPASS: ${{ secrets.APP_PASS }}


# Etapes du job
    steps:
      # Checkout repository under $GITHUB_WORKSPACE pour le job
      - uses: actions/checkout@v3
   
      # install sshpass Github <> OVH
      - name: install sshpass
        run: sudo apt-get install sshpass
   
      # git pull Github > OVH
      - name: git pull
        run: sshpass -e ssh -o stricthostkeychecking=no ${{ secrets.APP_USER }}@${{ secrets.APP_HOST }}
          "cd www/qaio/qap/qaio
          && git pull
          && cd qaio/
          && php composer.phar update
          && php bin/console cach:clear
          " 
        
        
