This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
165 lines (144 loc) · 5.59 KB
/
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Deploy
on:
push:
branches:
- blog
jobs:
build_static_pages:
name: Build Static Pages
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 13.2.0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- name: Setup Dependency
run: |
npm install hexo-cli@4.3.0 -g
npm install
sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev
python -m pip install pip -U
python -m pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
python -m pip config set install.trusted-host mirrors.aliyun.com
python -m pip install -r requirements.txt
- name: Generate Artifacts for qinyuanpei.github.io
run: |
hexo clean
git rev-parse HEAD > VERSION.txt
sudo rm _config.yml
sudo mv config-salve.yml _config.yml
hexo generate
python readme.py https://blog.yuanpei.me
sudo cp README.md ./public/README.md
sudo cp VERSION.txt ./public/VERSION.txt
sudo mkdir -p /home/runner/work/artifacts/qinyuanpei.github.io
sudo cp -r /home/runner/work/qinyuanpei.github.io/qinyuanpei.github.io/public/* /home/runner/work/artifacts/qinyuanpei.github.io
- name: Upload Artifacts for qinyuanpei.github.io
uses: actions/upload-artifact@v1
with:
name: qinyuanpei.github.io
path: /home/runner/work/artifacts/qinyuanpei.github.io
- name: Generate Artifacts for blog.yuanpei.me
run: |
hexo clean
git rev-parse HEAD > VERSION.txt
sudo rm _config.yml
sudo mv config-master.yml _config.yml
hexo generate
python readme.py https://blog.yuanpei.me
sudo cp README.md ./public/README.md
sudo cp VERSION.txt ./public/VERSION.txt
sudo mkdir -p /home/runner/work/artifacts/blog.yuanpei.me
sudo cp -r /home/runner/work/qinyuanpei.github.io/qinyuanpei.github.io/public/* /home/runner/work/artifacts/blog.yuanpei.me
- name: Upload Artifacts for blog.yuanpei.me
uses: actions/upload-artifact@v1
with:
name: blog.yuanpei.me
path: /home/runner/work/artifacts/blog.yuanpei.me
deploy_static_pages:
name: Deploy Static Pages
needs: build_static_pages
runs-on: ubuntu-latest
steps:
- name: Download Artifacts for qinyuanpei.github.io
uses: actions/download-artifact@v1
with:
name: qinyuanpei.github.io
- name: Deploy Artifacts for qinyuanpei.github.io
env:
GH_REPO: github.com/qinyuanpei/qinyuanpei.github.io.git
run: |
cd ./qinyuanpei.github.io
git init
git config user.name "qinyuanpei"
git config user.email "qinyuanpei@163.com"
git remote add origin https://$GH_REPO
git add .
git commit -m "${{ github.event.head_commit.message }}"
git push --force --quiet "https://${{ secrets.CI_TOKEN }}@$GH_REPO" master:master
- name: Download Artifacts for blog.yuanpei.me
uses: actions/download-artifact@v1
with:
name: blog.yuanpei.me
- name: Deploy Artifacts for blog.yuanpei.me
env:
GH_REPO: github.com/qinyuanpei/blog.yuanpei.me.git
run: |
cd ./blog.yuanpei.me
git init
git config user.name "qinyuanpei"
git config user.email "qinyuanpei@163.com"
git remote add origin https://$GH_REPO
git add .
git commit -m "${{ github.event.head_commit.message }}"
git push --force --quiet "https://${{ secrets.CI_TOKEN }}@$GH_REPO" master:master
- name: Generate README.md for github.com
env:
GH_REPO: github.com/qinyuanpei/qinyuanpei.git
run: |
sudo mkdir -p /home/runner/work/artifacts/
cd /home/runner/work/artifacts/
sudo git clone https://github.com/qinyuanpei/qinyuanpei.git
cd /home/runner/work/artifacts/qinyuanpei
sudo git config user.name "qinyuanpei"
sudo git config user.email "qinyuanpei@163.com"
sudo rm -f README.md
sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev
sudo python -m pip install pip -U
sudo python -m pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
sudo python -m pip config set install.trusted-host mirrors.aliyun.com
sudo python -m pip install -r requirements.txt
sudo python generator.py
sudo git add -f README.md
sudo git commit -m "Update README.md by Github Action"
sudo git push --force --quiet "https://${{ secrets.CI_TOKEN }}@$GH_REPO" master:master
audit_static_pages:
name: Audit Static Pages
needs: deploy_static_pages
runs-on: ubuntu-latest
steps:
- name: Lighthouse for blog.yuanpei.me
uses: jakejarvis/lighthouse-action@master
with:
url: 'https://blog.yuanpei.me'
- name: Upload Report for blog.yuanpei.me
uses: actions/upload-artifact@master
with:
name: blog.yuanpei.me_report
path: './report'
- name: Lighthouse for qinyuanpei.github.io
uses: jakejarvis/lighthouse-action@master
with:
url: 'https://qinyuanpei.github.io'
- name: Upload Report for qinyuanpei.github.io
uses: actions/upload-artifact@master
with:
name: qinyuanpei.github.io_report
path: './report'