Skip to content

Commit 85e9d80

Browse files
authored
[Refactor] 백엔드 CI/CD appleboy/ssh-action 액션 사용 (#210)
Refactor: 백엔드 cicd appleboy/ssh-action 액션 사용
1 parent 39ae06a commit 85e9d80

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

.github/workflows/deploy-express.yml

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,20 @@ on:
66

77
jobs:
88
deploy:
9+
name: deploy
910
runs-on: ubuntu-latest
1011
steps:
11-
- name: Git Checkout
12-
uses: actions/checkout@v4
13-
14-
- name: Install pnpm
15-
uses: pnpm/action-setup@v4
16-
with:
17-
version: 8.15.6
18-
19-
- name: Use Node.js
20-
uses: actions/setup-node@v4
21-
with:
22-
node-version: "20.x"
23-
cache: "pnpm"
24-
25-
- name: Install dependencies
26-
run: pnpm install
27-
28-
- name: Configure SSH
29-
uses: webfactory/ssh-agent@v0.8.0
30-
with:
31-
ssh-private-key: ${{ secrets.AWS_PRIVATE_KEY }}
32-
3312
- name: Deploy to EC2
34-
env:
35-
AWS_REGION: ${{ secrets.AWS_REGION }}
36-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
37-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
38-
AWS_EC2_HOST: ${{ secrets.AWS_EC2_HOST }}
39-
AWS_EC2_USER: ${{ secrets.AWS_EC2_USER }}
40-
run: |
41-
ssh -o StrictHostKeyChecking=no "$AWS_EC2_USER@$AWS_EC2_HOST" << 'EOF'
13+
uses: appleboy/ssh-action@v1.2.2
14+
with:
15+
host: ${{ secrets.AWS_EC2_HOST }}
16+
username: ${{ secrets.AWS_EC2_USER }}
17+
key: ${{ secrets.AWS_PRIVATE_KEY }}
18+
port: ${{secrets.SERVER_PORT}}
19+
script-stop: true
20+
script: |
4221
cd /home/ubuntu/codeit-resources
4322
git pull origin develop
4423
pnpm install
4524
pnpm --filter=api build
4625
pm2 restart codeit-server
47-
EOF

0 commit comments

Comments
 (0)