-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathdeploy.mjs
25 lines (19 loc) · 859 Bytes
/
deploy.mjs
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
#!/usr/bin/env zx
// user config
const originName = 'next'
// not care
const compressPkgName = `${originName}.tar.gz`
const user = 'root'
const origin = 'sugarat.top'
const fullOrigin = `${originName}.${origin}`
const baseServerDir = '/www/wwwroot'
const destDir = ''
await $`pnpm build`
await $`echo ==🔧 压缩dist ==`
await $`cd packages/blogpress/.vitepress && tar -zvcf ${compressPkgName} dist && rm -rf dist && mv ${compressPkgName} ./../../../`
await $`echo ==🚀 上传到服务器 ==`
await $`scp ${compressPkgName} ${user}@${fullOrigin}:./`
await $`rm -rf ${compressPkgName}`
await $`echo ==✅ 部署代码 ==`
await $`ssh -p22 ${user}@${fullOrigin} "tar -xf ${compressPkgName} -C ${baseServerDir}/${fullOrigin}/${destDir}"`
// await $`ssh -p22 ${user}@${origin} "tar -xf ${compressPkgName} -C ${baseServerDir}/blog.${origin}/${destDir}"`