32 lines
1.2 KiB
YAML
32 lines
1.2 KiB
YAML
name: Symfony CD - Scheduled Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
schedule:
|
|
# Déclenchement à 2h, 6h, 12h, 16h, 18h et 20h UTC
|
|
- cron: '0 2,20 * * *'
|
|
workflow_dispatch: # Bouton manuel dans GitHub Actions
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
jobs:
|
|
deploy:
|
|
name: 🚀 Deploy to Production
|
|
# Le job ne se lance que pour le cron ou manuellement, pas au push
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy with SSH
|
|
uses: appleboy/ssh-action@v1.0.0
|
|
with:
|
|
host: ${{ secrets.SSH_HOST }}
|
|
username: ${{ secrets.SSH_USER }}
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
port: 22
|
|
script: |
|
|
cd /var/www/ludikevent-intranet && sudo update-alternatives --set php /usr/bin/php8.4 && php bin/console app:maintenance on && git reset --hard HEAD && git pull origin master && sh ./update.sh && php bin/console app:maintenance off && php bin/console app:purge-cloudflare && sudo update-alternatives --set php /usr/bin/php8.3
|