@@ -36,33 +36,33 @@ jobs:
36
36
run : npm run test
37
37
38
38
39
- # deploy:
40
- # runs-on: ubuntu-latest
41
- # needs: build # ensures the deploy job runs after the build job
42
- # steps:
43
- # # Step 1: Checkout code
44
- # - name: Checkout code
45
- # uses: actions/checkout@v2
39
+ deploy :
40
+ runs-on : ubuntu-latest
41
+ needs : build # ensures the deploy job runs after the build job
42
+ steps :
43
+ # Step 1: Checkout code
44
+ - name : Checkout code
45
+ uses : actions/checkout@v2
46
46
47
- # # Step 2: Set up Node.js (again for deployment environment)
48
- # - name: Set up Node.js
49
- # uses: actions/setup-node@v2
50
- # with:
51
- # node-version: '14 '
47
+ # Step 2: Set up Node.js (again for deployment environment)
48
+ - name : Set up Node.js
49
+ uses : actions/setup-node@v2
50
+ with :
51
+ node-version : ' 18.x '
52
52
53
- # # Step 3: Install dependencies (again in the deployment environment)
54
- # - name: Install dependencies
55
- # run: npm install
53
+ # Step 3: Install dependencies (again in the deployment environment)
54
+ - name : Install dependencies
55
+ run : npm install
56
56
57
- # # Step 4: Deploy to the server via SSH
58
- # - name: Deploy to Server
59
- # run: |
60
- # ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
61
- # cd /path/to/your/project
62
- # git pull origin main
63
- # npm install
64
- # npm run build # if you have a build step, otherwise skip
65
- # pm2 restart all # or your preferred process manager
66
- # EOF
67
- # env:
68
- # SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
57
+ # Step 4: Deploy to the server via SSH
58
+ - name : Deploy to Server
59
+ run : |
60
+ ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
61
+ cd /next-js-app/app
62
+ git pull origin main
63
+ npm install
64
+ npm run build # if you have a build step, otherwise skip
65
+ pm2 restart all # or your preferred process manager
66
+ EOF
67
+ env :
68
+ SSH_PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
0 commit comments