Skip to content

Commit 9b85081

Browse files
committed
change github action
1 parent dfa967f commit 9b85081

File tree

11 files changed

+564
-1
lines changed

11 files changed

+564
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 🚀 Deploy project to SFTP server
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
sftp-deploy:
9+
name: 🧩 Deploying to SSH SFTP
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: 🔀 Checkout code from repository
14+
uses: actions/checkout@v4
15+
16+
- name: 🛠 Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20.x
20+
21+
- name: 📦 Install dependencies
22+
run: npm install
23+
24+
- name: 🧱 Build project
25+
run: npm run build
26+
27+
- name: 📥 Install sshpass
28+
run: sudo apt-get install -y sshpass
29+
30+
- name: 📤 Upload dist folder to remote SFTP server
31+
run: |
32+
sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no -P ${{ secrets.SSH_PORT }} -r dist/* ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_IP }}:${{ secrets.SSH_PATH }}

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# output
5+
out
6+
dist
7+
*.tgz
8+
9+
# code coverage
10+
coverage
11+
*.lcov
12+
13+
# logs
14+
logs
15+
_.log
16+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
18+
# dotenv environment variable files
19+
.env
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
.env.local
24+
25+
# caches
26+
.eslintcache
27+
.cache
28+
*.tsbuildinfo
29+
30+
# IntelliJ based IDEs
31+
.idea
32+
33+
# Finder (MacOS) folder config
34+
.DS_Store

README.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,85 @@
1-
# vuejs-cicd-deploy-sftp-ssh
1+
# 🚀 Vue.js CI/CD Deployment on SFTP SSH (via GitHub Actions)
2+
3+
This project demonstrates how to set up a **Vue 3 + Vite** project using **Bun** or **Node.js**, with automated deployment to **SSH SFTP VPS** using GitHub Actions.
4+
5+
---
6+
7+
## 📦 Tech Stack
8+
9+
-[Vue 3](https://vuejs.org/)
10+
- ⚗️ [Vite](https://vitejs.dev/)
11+
- 🧪 [Bun](https://bun.sh/) or [Node.js](https://nodejs.org/)
12+
- 🛠 GitHub Actions CI/CD
13+
14+
---
15+
16+
## 🧪 Development
17+
18+
Run locally with **Bun**:
19+
20+
```bash
21+
bun install
22+
bun run dev
23+
```
24+
25+
Or with npm:
26+
27+
```bash
28+
npm install
29+
npm run dev
30+
```
31+
32+
## ▶ GitHub Actions CI/CD
33+
34+
Automatic deployment is also set up via .github/workflows/deploy.yml. On every push to main, it:
35+
36+
- Installs dependencies
37+
- Runs the build script (to generate `dist` directory)
38+
- Upload `dist` directory into target VPS server via SFTP/SSH.
39+
40+
## 📁 Directory Structure
41+
42+
```bash
43+
.
44+
├── .github/workflows/deploy.yml # GitHub Actions CI/CD
45+
├── src/ # Vue app source code
46+
├── dist/ # Auto-generated after build
47+
├── index.html
48+
├── vite.config.ts
49+
└── package.json
50+
```
51+
52+
## 🛠 Scripts in package.json
53+
54+
55+
```json
56+
{
57+
"scripts": {
58+
"dev": "vite",
59+
"build": "vite build",
60+
"preview": "vite preview"
61+
}
62+
}
63+
```
64+
65+
## 🔐 Notes
66+
67+
You need to add some GitHub Actions env variables.
68+
69+
- `SSH_IP`
70+
- `SSH_PORT`
71+
- `SSH_USERNAME`
72+
- `SSH_PASSWORD`
73+
- `SSH_PATH`
74+
75+
## 👤 Author
76+
77+
Seyyed Ali Mohammadiyeh (Max Base)
78+
79+
📬 maxbasecode@gmail.com
80+
81+
🔗 https://github.com/BaseMax
82+
83+
## 🪪 License
84+
85+
MIT

bun.lock

Lines changed: 344 additions & 0 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Vue + GitHub Actions</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script type="module" src="/src/main.ts"></script>
10+
</body>
11+
</html>

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello via Bun!");

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "vuejs-cicd-deploy-sftp-ssh",
3+
"module": "index.ts",
4+
"type": "module",
5+
"private": true,
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vite build",
9+
"preview": "vite preview"
10+
},
11+
"devDependencies": {
12+
"@types/bun": "latest",
13+
"@vitejs/plugin-vue": "^5.2.4",
14+
"vite": "^6.3.5"
15+
},
16+
"peerDependencies": {
17+
"typescript": "^5.8.3"
18+
},
19+
"dependencies": {
20+
"vue": "^3.5.14"
21+
}
22+
}

src/App.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<h1>Hello from Vue + GitHub Actions!</h1>
3+
</template>
4+
5+
<script setup lang="ts">
6+
</script>

src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createApp } from 'vue';
2+
import App from './App.vue';
3+
4+
createApp(App).mount('#app');
5+

tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"module": "ESNext",
5+
"moduleResolution": "Node",
6+
"strict": true,
7+
"jsx": "preserve",
8+
"esModuleInterop": true,
9+
"skipLibCheck": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"baseUrl": ".",
12+
"paths": {
13+
"@/*": ["src/*"]
14+
}
15+
},
16+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
17+
}

vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vite';
2+
import vue from '@vitejs/plugin-vue';
3+
4+
export default defineConfig({
5+
plugins: [vue()],
6+
// base: '/vuejs-cicd-deploy-sftp-ssh/',
7+
});

0 commit comments

Comments
 (0)