40 lines
943 B
YAML
40 lines
943 B
YAML
name: Deploy to Plesk
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build project
|
|
run: |
|
|
npm install
|
|
npm run build # Angular → dist/portfolio/
|
|
|
|
- name: Deploy to Plesk
|
|
uses: appleboy/ssh-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.PLESK_HOST }}
|
|
username: ${{ secrets.PLESK_USER }}
|
|
key: ${{ secrets.PLESK_SSH_KEY }}
|
|
port: 22
|
|
script: |
|
|
TARGET=~/httpdocs/johanleroy/public
|
|
|
|
# Sauvegarde de l'ancien build
|
|
if [ -d $TARGET ]; then
|
|
mv $TARGET ${TARGET}_backup_$(date +%F_%H%M)
|
|
fi
|
|
|
|
# Créer le dossier cible si nécessaire
|
|
mkdir -p $TARGET
|
|
|
|
# Copier le build Angular
|
|
cp -r ./dist/portfolio/* $TARGET/
|