This commit is contained in:
39
.gitea/workflows/deploy.yml
Normal file
39
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
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/
|
||||
Reference in New Issue
Block a user