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