Fix formatting in main.yml #79
This file contains hidden or 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: Déployer l'application SvelteKit | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| MYSQL_HOST: ${{ secrets.MYSQL_HOST }} | |
| MYSQL_USER: ${{ secrets.MYSQL_USER }} | |
| MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} | |
| MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} | |
| steps: | |
| - name: Vérification du code source | |
| uses: actions/checkout@v3 | |
| - name: Configuration de l'agent SSH | |
| uses: webfactory/ssh-agent@v0.5.4 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Transfert du projet vers le VPS | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "rm -rf ${{ secrets.VPS_DIR }} && mkdir -p ${{ secrets.VPS_DIR }}" | |
| scp -r ./* ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:${{ secrets.VPS_DIR }} | |
| - name: Installation des dépendances | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "cd ${{ secrets.VPS_DIR }} && npm install" | |
| - name: Construction de l'application | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "cd ${{ secrets.VPS_DIR }} && npm run build" | |
| - name: Lancement de l'application | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "cd ${{ secrets.VPS_DIR }} && pm2 restart smartdesk || | |
| PORT=80 pm2 start ${{ secrets.VPS_DIR }}/build/index.js --name smartdesk" | |
| - name: Confirmation du déploiement | |
| run: echo "Déploiement terminé" |