-
Notifications
You must be signed in to change notification settings - Fork 71
145 lines (127 loc) · 4.27 KB
/
vuepress-deploy.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build and Deploy
on: [push, pull_request]
jobs:
sync-to-sustech-gitlab:
# Ensures that only one mirror task will run at a time.
concurrency:
group: git-mirror
cancel-in-progress: true
runs-on: ubuntu-latest
name: sync site to sustech git
if: github.event_name != 'pull_request' && github.repository_owner == 'SUSTech-CRA'
steps:
- name: Push to sustech-git
run: |
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
echo $tmp_dir
cd $tmp_dir
git clone --bare "${GITHUB_REPO_URL}" this_repo
cd this_repo
git config --global http.version HTTP/1.1
git config --global http.postBuffer 1048576000
git config --global https.postBuffer 1048576000
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
git push --verbose --force --mirror "https://${USER}:${PERSONAL_TOKEN}@${REMOTE_REPO_URL}"
env:
USER: project_252_bot
PERSONAL_TOKEN: ${{ secrets.SUSTECH_GITLAB_SYNC_TOKEN }}
GITHUB_REPO_URL: https://github.com/SUSTech-CRA/sustech-online-ng.git
REMOTE_REPO_URL: "mirrors.sustech.edu.cn/git/sustech-online/sustech-online-ng.git"
build:
concurrency:
group: page-build
cancel-in-progress: true
runs-on: ubuntu-latest
name: Build site
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: szenius/[email protected]
with:
timezoneLinux: "Asia/Shanghai"
- name: Check Time
run: date
- uses: actions/setup-node@v3
name: Install Node.js
with:
node-version-file: '.nvmrc'
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
# pnpm、node兼容性矩阵:https://pnpm.io/installation#compatibility
- name: Install Dependencies
run: pnpm install
- name: Check pnpm / node version
run: |
echo "pnpm version `pnpm --version`"
echo "node version `node -v`"
pnpm list
- name: Build Site
run: |
pnpm docs:clean
pnpm docs:build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: 'sustech-online-build'
path: './docs/.vuepress/dist/'
deploy-on-master:
name: Deploy site (master)
runs-on: "ubuntu-latest"
needs: build
if: github.repository_owner == 'SUSTech-CRA' && github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v3
with:
name: sustech-online-build
path: "./docs/.vuepress/dist/"
- name: Display structure of downloaded files
run: ls -R
working-directory: "./docs/.vuepress/dist/"
- name: Deploy to GitHub page
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vuepress/dist/
force_orphan: true
- name: copy file to server CAN-ZQ
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: "./docs/.vuepress/dist/"
remote_path: ${{ secrets.HTML_PATH }}
remote_host: ${{ secrets.HOST_CAN_ZQ }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.SSH_KEY }}
- name: copy file to server SZX-CC
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: "./docs/.vuepress/dist/"
remote_path: ${{ secrets.HTML_PATH }}
remote_host: ${{ secrets.HOST_SZX_CC }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.SSH_KEY }}
- name: copy file to server SZX
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: "./docs/.vuepress/dist/"
remote_path: ${{ secrets.HTML_PATH_SZX }}
remote_host: ${{ secrets.HOST_SZX }}
remote_user: ${{ secrets.USERNAME_SZX }}
remote_key: ${{ secrets.SSH_KEY_SZX }}
- name: copy file to server CAN
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: "./docs/.vuepress/dist/"
remote_path: ${{ secrets.HTML_PATH_SZX }}
remote_host: ${{ secrets.HOST_CAN }}
remote_user: ${{ secrets.USERNAME_SZX }}
remote_key: ${{ secrets.SSH_KEY_SZX }}