LINUX教学:构建GitBook并基于GitLab自动发布
《LINUX教学:构建GitBook并基于GitLab自动发布》要点: 整个GitBook构建过程分为以下几个部门: 安装node,npm部署gitbook gitlab版本8以上支持pipelines,服务器上安装,配置gitlab runner. 1.安装node curl?-sL?https://rpm.nodesource.com/setup_6.x?|?bash?-? (6.9.5) yum?install?-y?nodejs 2.安装gitbook npm?install?-g?gitbook-cli 3.gitlab-ci实现 gitlab的CI主要通过新版本的pipelines功能. 实现原理: 在部署服务器上运行一个gitlab的runner,并且在gitlab项目的根目录下创建.gitlab-ci.yml文件,里面主要保留一些运行 脚本,当有新数据被push时,就会执行其中的代码,实现持续集成. 实现步骤: 1.在项目根目录下新建.gitlab-ci.yml文件,内容如下 rspec: ? script: ? ? -?gitbook?init ? ? -?gitbook?build ? ? -?sh?start.sh 当项目内容更新时,更新的内容就会pull到部署服务器,然后依次执行上面代码,完成gitbook的更新. 2.安装runner到服务器上 #增加gitlab的yum源仓库 curl?-L?https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh?|?sudo?bash #yum安装runner yum?install?gitlab-ci-multi-runner 为了把runner添加到gitlab项目中,必要项目的token和gitlab的url,在服务器上运行如下代码: gitlab-ci-multi-runner?register Please?enter?the?gitlab-ci?coordinator?URL?(e.g.?https://gitlab.com/): your?url Please?enter?the?gitlab-ci?token?for?this?runner: your?token Please?enter?the?gitlab-ci?description?for?this?runner: [opstest]:? Please?enter?the?gitlab-ci?tags?for?this?runner?(comma?separated): opsdoc? Whether?to?run?untagged?builds?[true/false]: [false]:true? #此处我选择的是true,否则每次push还得弄tag? Whether?to?lock?Runner?to?current?project?[true/false]: [false]:? Registering?runner...?succeeded 然后根据提示信息输入,具体的token和url在项目的 ? 本文永远更新链接地址: 编程之家PHP培训学院每天发布《LINUX教学:构建GitBook并基于GitLab自动发布》等实战技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培养人才。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |