File tree Expand file tree Collapse file tree 1 file changed +13
-18
lines changed
Expand file tree Collapse file tree 1 file changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -16,33 +16,28 @@ jobs:
1616 - name : Setup SSH
1717 run : |
1818 mkdir -p ~/.ssh
19- echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
19+ echo "${{ secrets.EC2_SSH_KEY }}" | base64 --decode > ~/.ssh/id_rsa
2020 chmod 600 ~/.ssh/id_rsa
2121 ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
2222
2323 - name : Deploy to EC2
2424 run : |
25- ssh ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
25+ ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
2626 set -e
27+ cd ~/ssakssak-commit
2728
28- bash -l << 'INNER'
29- set -e
29+ echo "๐ฆ Pull latest code"
30+ git pull origin main
3031
31- cd ~/ssakssak-commit
32+ echo "๐ฆ Install dependencies"
33+ npm ci
3234
33- echo "๐ฆ Pull latest code "
34- git pull origin main
35+ echo "๐ Build Next.js "
36+ npm run build
3537
36- echo "๐ฆ Install dependencies"
37- npm ci
38+ echo "๐ Reload PM2 apps"
39+ pm2 reload next-app || pm2 start npm --name "next-app" -- run start -- --port 3000
40+ pm2 reload ssakssak-worker || pm2 start npm --name "ssakssak-worker" -- run worker:start
3841
39- echo "๐ Build Next.js"
40- npm run build
41-
42- echo "๐ Reload PM2 apps"
43- pm2 reload next-app || pm2 start npm --name "next-app" -- run start -- --port 3000
44- pm2 reload ssakssak-worker || pm2 start npm --name "ssakssak-worker" -- run worker:start
45-
46- pm2 save
47- INNER
42+ pm2 save
4843 EOF
You canโt perform that action at this time.
0 commit comments