forked from v2ray/manual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·61 lines (46 loc) · 1.34 KB
/
deploy.sh
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
57
58
59
60
61
#!/bin/bash
set -x
curl -sL https://deb.nodesource.com/setup_7.x | bash -
apt-get update
apt-get -y install jq git file nodejs build-essential
function build_dir {
DIR="$1"
pushd $DIR
rsync -rv ../_layouts/ ./_layouts/
rsync -rv ../resources/ ./resources/
cp ../donor.md ./donor.md
gitbook init
gitbook install
gitbook build
popd
}
function getattr() {
curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/$2/attributes/$1
}
GITHUB_TOKEN=$(getattr "github_token" "project")
git clone https://github.com/v2ray/manual.git
cd manual
curl -o "./resources/github-release.svg" "https://img.shields.io/github/release/v2ray/v2ray-core.svg"
npm install gitbook-cli -g
build_dir zh_cn
build_dir en
build_dir blog
TARGET_DIR=_v2ray_com
git clone "https://github.com/v2ray/v2ray.github.io.git" ${TARGET_DIR}
rm -rf ${TARGET_DIR}/*
cp -r ./zh_cn/_book/* ${TARGET_DIR}/
mkdir ${TARGET_DIR}/en/
cp -r ./en/_book/* ${TARGET_DIR}/en/
mkdir ${TARGET_DIR}/blog/
cp -r ./blog/_book/* ${TARGET_DIR}/blog/
cp -r ./_dev/* ${TARGET_DIR}/
cp CNAME ${TARGET_DIR}/
cp robots.txt ${TARGET_DIR}/
pushd ${TARGET_DIR}
git config user.name "V2Ray Auto Build"
git config user.email "[email protected]"
git add -A
git commit -m 'update'
git push "https://${GITHUB_TOKEN}@github.com/v2ray/v2ray.github.io.git" master
popd
shutdown -h +5