Skip to content

Commit 3b58a83

Browse files
committed
feat: add ci vps ovh vuejs 3
1 parent b7c3daf commit 3b58a83

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

.github/workflows/deploy-app.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,56 @@
1-
name: 🚀 Deploy app to o2switch
1+
name: 🚀 Deploy Vue.js 3 App to VPS
22

33
on:
44
push:
55
branches: [ 'main' ]
6+
paths:
7+
- 'app/**'
68
pull_request:
79
branches: [ 'main' ]
10+
paths:
11+
- 'app/**'
812
workflow_dispatch:
913

1014
jobs:
1115
deploy:
1216
runs-on: ubuntu-latest
17+
env:
18+
APP_DIR: /var/www/aparteasy.dibodev.com
1319

1420
steps:
1521
- name: 🚚 Get latest code
16-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
1723

1824
- name: 🚀 Setup Node.js
19-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2026
with:
21-
node-version: '16.x'
27+
node-version: 18
2228

2329
- name: 🔍 Install dependencies
24-
run: cd app && npm install
30+
run: cd app && npm install
2531

2632
- name: 🧱 Build application
2733
run: cd app && npm run build
2834

29-
- name: 📂 Sync files
30-
uses: SamKirkland/[email protected]
35+
- name: 📤 Deploy to VPS
36+
uses: easingthemes/ssh-deploy@main
3137
with:
32-
server: ${{ secrets.FTP_SERVER }}
33-
username: ${{ secrets.FTP_USERNAME }}
34-
password: ${{ secrets.FTP_PASSWORD }}
35-
port: 21
36-
protocol: ftp
37-
local-dir: ./app/dist/
38-
server-dir: aparteasy.dibodev.com/
38+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
39+
ARGS: "-azrut --delete"
40+
SOURCE: "app/dist/"
41+
REMOTE_HOST: ${{ secrets.SSH_HOST }}
42+
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
43+
REMOTE_PORT: ${{ secrets.SSH_PORT }}
44+
TARGET: ${{ env.APP_DIR }}
45+
SCRIPT_BEFORE: |
46+
if ! command -v rsync &> /dev/null
47+
then
48+
echo "rsync could not be found, installing..."
49+
sudo apt-get update
50+
sudo apt-get install -y rsync
51+
else
52+
echo "rsync is already installed."
53+
fi
54+
echo "Starting deployment..."
55+
SCRIPT_AFTER: |
56+
echo "Vue.js app deployed successfully!"

0 commit comments

Comments
 (0)