-
Notifications
You must be signed in to change notification settings - Fork 17
73 lines (63 loc) · 2 KB
/
Copy pathdeploy.yml
File metadata and controls
73 lines (63 loc) · 2 KB
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
name: crawler
on:
push:
branches:
- code
schedule:
# 定时任务,每晚 22:30 更新数据
- cron: '30 22 * * *'
env:
GIT_USER: wonderkun
GIT_EMAIL: dekunwang2014@gmail.com
DEPLOY_REPO: wonderkun/crawler
DEPLOY_BRANCH: master
jobs:
build:
name: Build on python ${{ matrix.python_version }} and ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python_version: [3.x]
chrome_version: [91.0.4472.19]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout deploy repo
uses: actions/checkout@v2
with:
repository: ${{ env.DEPLOY_REPO }}
ref: ${{ env.DEPLOY_BRANCH }}
path: crawler
- name: Setup python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
architecture: x64
- name: Set pip
uses: BSFishy/pip-action@v1
with:
requirements: ./crawler/.code/requirements.txt
- name: Setup chromedriver ${{ matrix.chrome_version }}
uses: nanasess/setup-chromedriver@master
with:
chromedriver-version: ${{ matrix.chrome_version }}
- name: Configuration environment
env:
HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}}
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$HEXO_DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name $GIT_USER
git config --global user.email $GIT_EMAIL
cd ./crawler/.code/
python main.py
- name: Deploy github
run: |
cd ./crawler/
git add .
git commit -m "Github action auto deploy my blog."
git push git@github.com:wonderkun/crawler.git master:master