.gitlab-ci.yml配置文件,以便上传代码后GitLab CI使用。expire_in,不然会自动删除的。第二个是我这里配置了分支是
master,这个依自己情况而定。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# This file is a template, and might need editing before it works on your project. # Full project: https://gitlab.com/pages/hexo image: node:12.14.1 cache: paths: - node_modules/ before_script: - npm install hexo-cli -g - test -e package.json && npm install - hexo generate pages: script: - hexo generate artifacts: expire_in: 3 days # <== !!! paths: - public # <== 每次会将生成的 public 文件夹当成附件,保存起来 only: - master |
.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 |
# This file is a template, and might need editing before it works on your project. # Full project: https://gitlab.com/pages/hexo image: node:12.14.1 cache: paths: - node_modules/ before_script: - npm install hexo-cli -g - test -e package.json && npm install - hexo generate pages: script: - hexo generate - apt-get update -qq && apt-get install -y -qq lftp artifacts: expire_in: 3 days # <== !!! paths: - public # <== 每次会将生成的 public 文件夹当成附件,保存起来 only: - master after_script: - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rev public/ ./ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/" |
$USERNAME
$PASSWORD
$HOST来获取CI/CD中提前配置好的变量值。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69984138/viewspace-2726613/ ,如需转载,请注明出处,否则将追究法律责任。