doc: add GitLab-CI with lftp section

This commit is contained in:
Leon Xu committed 2021-08-26 23:15:15 -07:00
1 parent c34d546ce3
commit 7605def2bf
1 file changed
+21 -1
+21 -1
View File
@@ -37,6 +37,24 @@ cache:
paths:
- node_modules/
```
### 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.
<br>
```yaml
# Using the latest ubuntu image
image: ubuntu:latest
before_script:
- apt-get update -qy
- apt-get install -y lftp
build:
script:
# Sync to FTP
- lftp -e "open $FTP_HOST; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete public/ $FTP_REMOTE_PATH/; bye"
### GitLab-CI
We need to prepare our `gitlab-ci.yml` configuration file to do as we described previously.
@@ -327,6 +345,8 @@ Modify [`package.json`]:
[SSG]: https://www.staticgen.com/
[Themes]: https://hexo.io/themes/
[lftp]: https://lftp.tech/
[`_config.yml`]: https://gitlab.com/leonxu260/hexo-butterfly/blob/master/_config.yml
[`.gitlab-ci.yml`]: https://gitlab.com/leonxu260/hexo-butterfly/blob/master/_config.yml
[`package.json`]: https://gitlab.com/leonxu260/hexo-butterfly/blob/master/package.json
[`package.json`]: https://gitlab.com/leonxu260/hexo-butterfly/blob/master/package.json