-
Notifications
You must be signed in to change notification settings - Fork 192
56 lines (47 loc) · 1.49 KB
/
main-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Production Deployment
on:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-prod:
runs-on: ubuntu-latest
steps:
- name : Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install Dependencies
run: npm install
- name: Build Application
run: |
npm run build
cp package.json deployment.sh main-ecosystem-config.json dist
- name: Archive application build
run: |
tar -czf nestjs-prod.tar.gz dist
- name: Copy Artifacts to server
run: |
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no nestjs-prod.tar.gz ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/nestjs
rm -f nestjs-prod.tar.gz
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd boilerplate/nestjs/prod
tar -xzf /tmp/nestjs/nestjs-prod.tar.gz -C .
rm -f /tmp/nestjs/nestjs-prod.tar.gz
mv dist/package.json .
mv dist/main-ecosystem-config.json .
mv dist/deployment.sh .
chmod +x deployment.sh
./deployment.sh main