File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed
Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Frontend Deploy
2+
3+ on :
4+ push :
5+ branches :
6+ - setup
7+ - main
8+
9+ jobs :
10+ deploy :
11+ runs-on : ubuntu-latest
12+ needs : [test-and-build]
13+
14+ steps :
15+ - name : Checkout Repository
16+ uses : actions/checkout@v4
17+
18+ - name : Download Build Artifacts
19+ uses : actions/download-artifact@v4
20+ with :
21+ name : next-build
22+ path : .next
23+
24+ - name : Install sshpass
25+ run : sudo apt-get install -y sshpass
26+
27+ - name : Deploy to Production Server
28+ run : |
29+ echo "🚀 Deploying .next build to server..."
30+ sshpass -p "${{ secrets.SERVER_PASSWORD }}" scp -o StrictHostKeyChecking=no -r .next package.json pnpm-lock.yaml \
31+ "${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/home/${{ secrets.SERVER_USER }}/AI-Ad-Gen-Frontend"
32+
33+ - name : Start Application on Server
34+ run : |
35+ sshpass -p "${{ secrets.SERVER_PASSWORD }}" ssh -o StrictHostKeyChecking=no \
36+ "${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}" << 'EOF'
37+ set -e # Stop script on error
38+ cd /home/${{ secrets.SERVER_USER }}/AI-Ad-Gen-Frontend
39+ pnpm install --frozen-lockfile
40+ pm2 delete ai-adgen-frontend || true
41+ pm2 start pnpm --name ai-adgen-frontend -- start
42+ EOF
Original file line number Diff line number Diff line change 1+ name : Frontend Test
2+
3+ on :
4+ push :
5+ branches :
6+ - setup
7+ - main
8+
9+ jobs :
10+ test-and-build :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout Repository
15+ uses : actions/checkout@v4
16+
17+ - name : Setup Node.js
18+ uses : actions/setup-node@v4
19+ with :
20+ node-version : " 20.x"
21+
22+ - name : Setup pnpm
23+ uses : pnpm/action-setup@v3
24+ with :
25+ version : latest
26+
27+ - name : Install Dependencies
28+ run : pnpm install --frozen-lockfile
29+
30+ - name : Build Frontend
31+ run : pnpm build
32+
33+ - name : Upload Build Artifacts
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : next-build
37+ path : " ${{ env.NEXT_PATH }}/*"
38+ if-no-files-found : error
39+ include-hidden-files : true
You can’t perform that action at this time.
0 commit comments