-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (47 loc) · 1.46 KB
/
deploy.yaml
File metadata and controls
57 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy React Vite to ovh
on:
workflow_dispatch:
push:
branches:
- main # branche à déployer
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1️⃣ Récupération du code
- name: 🚚 Checkout repository
uses: actions/checkout@v3
# 2️⃣ Installer Node.js
- name: ⚙️ Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
# 3️⃣ Installer dépendances
- name: ⬇️ Install dependencies
run: npm install
# 4️⃣ Build Vite
- name: 🏗️ Build project
run: npm run build
# 5️⃣ Ajouter .htaccess pour SPA
- name: ➕ Add .htaccess
run: |
BASE=${{ secrets.BASE_PATH }}
cat > build/.htaccess <<EOL
RewriteEngine On
RewriteBase ${BASE}
RewriteRule ^index\\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . ${BASE}index.html [L]
EOL
# 6️⃣ Déployer via FTP
- name: 🚀 Deploy via FTP
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: ./build/
server-dir: ${{ secrets.FTP_PATH }} # ex: /public_html/ ou /aymeric/
delete: true
dry-run: false