doc: update scripts for lftp section that include stage of build and deploy

This commit is contained in:
Leon Xu committed 2021-08-26 23:25:16 -07:00
1 parent 270f0f2202
commit 73a6256ced
1 file changed
+24 -8
+24 -8
View File
@@ -43,17 +43,33 @@ If I want GitLab CI/CD to deploy my website each time that I push to GitLab, I c
<br>
```yaml
# Using the latest ubuntu image
image: ubuntu:latest
build website:
stage: build
# Using the latest of ubuntu image
image: ubuntu:latest
before_script:
- apt-get update -qy
- apt-get install -y lftp
cache:
paths:
- node_modules/ # Node modules and dependencies
build:
before_script:
- apt-get update -qy # Check for update
- apt-get install -y lftp # Install lftp
- 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 via lftp:
stage: deploy
script:
# Sync to FTP
- lftp -e "set ssl:verify-certificate no; open $FTP_HOST; user $FTP_USERNAME $FTP_PASSWORD $FTP_PORT; mirror -X .* -X .*/ --reverse --verbose --delete public/ $FTP_REMOTE_PATH/; bye"
- hexo clean # Hexo clean previous static site
- hexo generate # Hexo generate Static Site
artifacts:
paths:
- public
only:
- master # this job will affect only the 'master' branch
### GitLab-CI
We need to prepare our `gitlab-ci.yml` configuration file to do as we described previously.