# ce job permet de mettre à jour le repository OVH à partir de Github 

name: auto_cibuild_ongitpush

# ce job s’execute suite à push / pull_request ou Manuellement 
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    environment: development
    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/qab/qaio
          && git pull
          && cd qaio/
          && php composer.phar update
          && php bin/console cach:clear
          " 
        
        
