From eb6d2065badf42df862becac3d942de8beaee16c Mon Sep 17 00:00:00 2001 From: Leon Xu <6479451-leonxu260@users.noreply.gitlab.com> Date: Fri, 27 Aug 2021 12:04:57 -0700 Subject: [PATCH] doc: add current gitlab-ci.yml script that I am using --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index d6c2b3e..b5ca71a 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,33 @@ cache: - node_modules/ ``` +### Current GitLab CI +Here is the current GitLab CI that I am using in my `gitlab-ci.yml`. +```yaml +build website: + stage: build + # requiring the environment of latest NodeJS version + image: node:latest + # add 'node_modules' to cache for speeding up builds + cache: + paths: + - node_modules/ # Node modules and dependencies + script: + - npm install -g hexo-cli # Install Hexo itself + - npm install # Install Hexo modules and dependencies + - npm install hexo-renderer-pug # Install Butterfly pug + - npm install hexo-renderer-stylus # Install stylus renderer + +deploy to website: + stage: deploy + script: + - hexo clean # Hexo clean previous static site + - hexo generate # Hexo generate Static Site + - hexo deploy + only: + - master # this job will affect only the 'master' branch +``` + ### GitLab-CI with lftp If I want GitLab CI/CD to deploy my website each time that I push to GitLab, I can use something called [lftp][lftp]. Here is what you can do in the `gitlab-ci.yml` configuration file.