-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.57 KB
/
deploy-app.yml
File metadata and controls
62 lines (54 loc) · 1.57 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
58
59
60
61
62
name: 🚀 Deploy Vue.js 3 App to VPS
on:
push:
branches: [ 'main' ]
paths:
- 'app/**'
pull_request:
branches: [ 'main' ]
paths:
- 'app/**'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
env:
APP_DIR: /var/www/aparteasy.dibodev.fr
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v4
- name: 🚀 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: 🔍 Install dependencies
run: cd app && npm install
- name: 📝 Setup Production .env File
run: cd app && cp .env.example .env
- name: 🧱 Build application
run: |
cd app
npm run build
cp .env dist/.env
- name: 📤 Deploy to VPS
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-azrut --delete"
SOURCE: "app/dist/"
REMOTE_HOST: ${{ secrets.SSH_HOST }}
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
REMOTE_PORT: ${{ secrets.SSH_PORT }}
TARGET: ${{ env.APP_DIR }}/html
SCRIPT_BEFORE: |
if ! command -v rsync &> /dev/null
then
echo "rsync could not be found, installing..."
sudo apt-get update
sudo apt-get install -y rsync
else
echo "rsync is already installed."
fi
echo "Starting deployment..."
SCRIPT_AFTER: |
echo "Vue.js app deployed successfully!"