hexo自动化部署配置

hexo自动化部署配置

.gitlab-ci.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
image: node:lts-alpine
cache:
  paths:
    - node_modules/

before_script:
  - npm config set registry https://registry.npm.taobao.org/
  - npm install hexo-cli -g
  - npm install hexo-generator-searchdb --save
  - npm install hexo-abbrlink --save
  - npm install hexo-deployer-git --save
  - npm install
  - sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
  - apk --update add openssh-client
  - apk --update add git
  - eval $(ssh-agent -s)
  - chmod 700 private_key
  - ssh-add private_key
  - git config --global user.email "[email protected]"
  - git config --global user.name "xx"
  - echo StrictHostKeyChecking no >> /etc/ssh/ssh_config

pages:
  script:
    - hexo generate --deploy
  artifacts:
    expire_in: 1 day
    paths:
      - public
  only:
    - master
Licensed under CC BY-NC-SA 4.0