-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
37 lines (31 loc) · 1.09 KB
/
Taskfile.yml
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
version: "3"
dotenv:
- .env
- "{{.ENV}}/.env."
- "{{.HOME}}/.env"
tasks:
build:
desc: Build the application
cmds:
- npm run build
deploy:files:
desc: Copy necessary files to server
cmds:
- rsync -avz --exclude 'node_modules' --exclude '.git' src/ dist/ package*.json deploy.sh .env tsconfig.json {{.DEPLOY_SERVER_USER}}@{{.DEPLOY_SERVER_HOST}}:{{.DEPLOY_PATH}}
deploy:install:
desc: Install dependencies on server
cmds:
- ssh {{.DEPLOY_SERVER_USER}}@{{.DEPLOY_SERVER_HOST}} "cd {{.DEPLOY_PATH}} && npm install --omit=dev"
- ssh {{.DEPLOY_SERVER_USER}}@{{.DEPLOY_SERVER_HOST}} "cd {{.DEPLOY_PATH}} && chmod +x deploy.sh"
deploy:restart:
desc: Restart the application
cmds:
- ssh {{.DEPLOY_SERVER_USER}}@{{.DEPLOY_SERVER_HOST}} "cd {{.DEPLOY_PATH}} && pm2 delete discord-bot || true"
- ssh {{.DEPLOY_SERVER_USER}}@{{.DEPLOY_SERVER_HOST}} "cd {{.DEPLOY_PATH}} && ./deploy.sh"
deploy:
desc: Deploy the application
deps: [build]
cmds:
- task: deploy:files
- task: deploy:install
- task: deploy:restart