{"id":43403,"date":"2020-02-29T13:26:35","date_gmt":"2020-02-29T05:26:35","guid":{"rendered":"http:\/\/4563.org\/?p=43403"},"modified":"2020-02-29T13:28:07","modified_gmt":"2020-02-29T05:28:07","slug":"travis-ci-%e5%8a%a0-hexo-%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e6%9e%84%e5%bb%ba%e9%83%a8%e7%bd%b2-github-pages-%e5%8d%9a%e5%ae%a2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=43403","title":{"rendered":"Travis CI \u52a0 Hexo \u5b9e\u73b0\u81ea\u52a8\u6784\u5efa\u90e8\u7f72 Github Pages \u535a\u5ba2"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-43457\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/02\/20200229_052753.png\" alt=\"\" width=\"437\" height=\"230\" \/><\/p>\n<p>Travis CI \u52a0 Hexo \u5b9e\u73b0\u81ea\u52a8\u6784\u5efa\u90e8\u7f72 Github Pages \u535a\u5ba2<\/p>\n<p>\u6700\u8fd1\u5199\u4e86\u4e00\u4e2a Travis CI \u81ea\u52a8\u90e8\u7f72 Hexo \u535a\u5ba2\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5199\u5b8c push \u4e4b\u540e\u5c31\u53ef\u4ee5\u81ea\u52a8\u90e8\u7f72\u5230 GitHub Pages<\/p>\n<p>\u601d\u8def\u662fTravis CI \u4f1a\u6267\u884c\u7528\u6237\u5b9a\u4e49\u7684 <code>.travis.yml<\/code> \u811a\u672c\uff0c\u56e0\u6b64\u53ea\u9700\u5728\u811a\u672c\u4e2d\u5b9e\u73b0\uff1a\u4f7f\u7528 Hexo \u751f\u6210\u535a\u5ba2\u5185\u5bb9\uff0c\u518d\u5c06\u535a\u5ba2\u5185\u5bb9\u90e8\u7f72\u5230 <code>username.github.io<\/code> \u9879\u76ee\u7684 master \u5206\u652f\u4e0a<\/p>\n<p>=========================================================<\/p>\n<p>\u51e0\u5929\u524d\u91cd\u65b0\u5b89\u88c5 <strong>fedora 31<\/strong>, \u4e8e\u662f\u8d81\u7740\u8fc7\u5e74\u5728\u5bb6\u91cd\u65b0\u642d\u5efa\u4e86\u8fd9\u4e2a\u535a\u5ba2\uff0c\u987a\u4fbf\u6298\u817e\u4e86 <strong>Travis CI<\/strong> \u6765\u81ea\u52a8\u6784\u5efa\u90e8\u7f72\u6211\u7684\u535a\u5ba2\uff0c\u7136\u540e\u628a\u6211\u7684 Hexo \u535a\u5ba2\u6587\u4ef6\u653e\u5230\u4e86 Github \u4e0a\uff0c\u7ec8\u4e8e\u4e0d\u7528\u6015\u6211\u91cd\u65b0\u5b89\u88c5\u7cfb\u7edf\u65f6\u5fd8\u8bb0\u5907\u4efd\u6211\u7684\u535a\u5ba2\u4e86\u3002<del>\u4e4b\u524d\u6709\u51e0\u6b21\u5fd8\u8bb0\u5907\u4efd\u6211\u7684 Hexo \u535a\u5ba2\u6587\u4ef6\u3002\u7136\u540e\u6211\u7684\u535a\u5ba2\u2026\u5c31\u6ca1\u6709\u7136\u540e\u4e86\u3002<\/del><\/p>\n<h2 id=\"\u9884\u5148\u51c6\u5907\">\u9884\u5148\u51c6\u5907<\/h2>\n<ul>\n<li>Git<\/li>\n<li>npm<\/li>\n<li>Travis CI<\/li>\n<li>Github<\/li>\n<\/ul>\n<h2 id=\"\u64cd\u4f5c\">\u64cd\u4f5c<\/h2>\n<h3 id=\"\u5b89\u88c5-Hexo\">\u5b89\u88c5 Hexo<\/h3>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">npm install -g hexo-cli<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 id=\"\u914d\u7f6e-Hexo\">\u914d\u7f6e Hexo<\/h3>\n<h4 id=\"\u521d\u59cb\u5316-Hexo-\u7ad9\u70b9\">\u521d\u59cb\u5316 Hexo \u7ad9\u70b9<\/h4>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">hexo init username.github.io<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p><code>username<\/code> \u662f\u4f60\u7684 Github \u7528\u6237\u540d\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u628a <code>username.github.io<\/code> \u66ff\u6362\u6210\u4f60\u60f3\u8981\u7684\u4efb\u4f55\u540d\u5b57<\/p>\n<h4 id=\"\u505a\u4e00\u4e9b\u5fc5\u8981\u7684\u4fee\u6539\">\u505a\u4e00\u4e9b\u5fc5\u8981\u7684\u4fee\u6539<\/h4>\n<ol>\n<li>\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u7ad9\u70b9\u7684 <code>_config.yml<\/code><\/li>\n<li>\u6700\u4e3b\u8981\u662f\u4fee\u6539\u4e0b\u9762\u8fd9\u4e9b<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>\u9879\u76ee<\/th>\n<th>\u89e3\u91ca<\/th>\n<th>\u600e\u4e48\u6539<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>title<\/code><\/td>\n<td>\u7f51\u7ad9\u7684\u6807\u9898<\/td>\n<td>\u5565\u90fd\u884c\uff0c\u4f8b\u5982\u6211\u7684\u7ad9\u70b9\u6807\u9898\u53eb <code>Ne0Ng's Blog<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>author<\/code><\/td>\n<td>\u4f60\u7684\u540d\u5b57<\/td>\n<td>\u8fd9\u4e2a\u586b\u4e0a\u4f60\u7684\u540d\u5b57<\/td>\n<\/tr>\n<tr>\n<td><code>language<\/code><\/td>\n<td>\u7f51\u7ad9\u7684\u8bed\u8a00<\/td>\n<td>\u90fd\u80fd\u770b\u6211\u7684\u535a\u5ba2\u4e86\uff0c\u90a3\u5c31\u6539\u6210 <code>zh-CN<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>timezone<\/code><\/td>\n<td>\u7f51\u7ad9\u7684\u65f6\u533a<\/td>\n<td>\u56fd\u5185\u7684\u5730\u533a\u90fd\u586b\u4e0a <code>Asia\/Shanghai<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>url<\/code><\/td>\n<td>\u7f51\u7ad9\u7684\u94fe\u63a5<\/td>\n<td>\u5982\u679c\u4f60\u6ca1\u6709\u57df\u540d\u7684\u8bdd\uff0c\u5c31\u586b <code>username.github.io<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote><p>\u5176\u4ed6\u7684\u4fee\u6539\u53ef\u4ee5\u53c2\u8003 Hexo \u7684\u6587\u6863<\/p>\n<p><a href=\"https:\/\/hexo.io\/docs\/configuration\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Configuration | Hexo Doc<\/a><\/p><\/blockquote>\n<h4 id=\"\u4fee\u6539\u7ad9\u70b9\u7684\u4e3b\u9898\">\u4fee\u6539\u7ad9\u70b9\u7684\u4e3b\u9898<\/h4>\n<blockquote><p>\u5728\u672c\u6587\u91cc\u9762\uff0c\u4ee5 <code>Suka<\/code> \u4e3b\u9898\u4e3a\u4f8b\u5b50<\/p>\n<p>\u66f4\u591a\u81ea\u5b9a\u4e49\u53c2\u8003 <a href=\"https:\/\/theme-suka.skk.moe\/docs\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Suka Doc<\/a><\/p><\/blockquote>\n<ol>\n<li>\u5b89\u88c5\u4e3b\u9898<\/li>\n<\/ol>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"built_in\">cd<\/span> themes<\/span>\r\n<span class=\"line\">git <span class=\"built_in\">clone<\/span> https:\/\/github.com\/SukkaW\/hexo-theme-suka.git suka<\/span>\r\n<span class=\"line\"><span class=\"built_in\">cd<\/span> suka<\/span>\r\n<span class=\"line\">npm install --production<\/span>\r\n<span class=\"line\">cp -i _config.example.yml _config.yml<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<ol start=\"2\">\n<li>\u542f\u7528\u4e3b\u9898<\/li>\n<\/ol>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"comment\"># \u56de\u5230\u7ad9\u70b9\u7684\u6839\u76ee\u5f55<\/span><\/span>\r\n\r\n<span class=\"line\">cat themes\/suka\/site_config.yml &gt;&gt; _config.yml<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u7f16\u8f91\u7ad9\u70b9\u7684 <code>_config.yml<\/code>\uff0c\u5c06 <code>theme: landscape<\/code> \u6539\u4e3a <code>theme: suka<\/code><\/p>\n<p>\u6539\u597d\u4e4b\u540e\uff0c\u4f60\u7ad9\u70b9\u7684 <code>_config.yml<\/code> \u5927\u6982\u662f\u8fd9\u6837<\/p>\n<figure class=\"highlight yml\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span>\r\n<span class=\"line\">6<\/span>\r\n<span class=\"line\">7<\/span>\r\n<span class=\"line\">8<\/span>\r\n<span class=\"line\">9<\/span>\r\n<span class=\"line\">10<\/span>\r\n<span class=\"line\">11<\/span>\r\n<span class=\"line\">12<\/span>\r\n<span class=\"line\">13<\/span>\r\n<span class=\"line\">14<\/span>\r\n<span class=\"line\">15<\/span>\r\n<span class=\"line\">16<\/span>\r\n<span class=\"line\">17<\/span>\r\n<span class=\"line\">18<\/span>\r\n<span class=\"line\">19<\/span>\r\n<span class=\"line\">20<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"comment\"># Extensions<\/span><\/span>\r\n<span class=\"line\"><span class=\"comment\">## Plugins: https:\/\/hexo.io\/plugins\/<\/span><\/span>\r\n<span class=\"line\"><span class=\"comment\">## Themes: https:\/\/hexo.io\/themes\/<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">theme:<\/span> <span class=\"string\">suka<\/span><\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># Deployment<\/span><\/span>\r\n<span class=\"line\"><span class=\"comment\">## Docs: https:\/\/hexo.io\/docs\/deployment.html<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">deploy:<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">type:<\/span> <span class=\"string\">''<\/span><\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># Suka-theme<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">suka_theme:<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">search:<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">enable:<\/span> <span class=\"literal\">true<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">path:<\/span> <span class=\"string\">search.json<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">field:<\/span> <span class=\"string\">post<\/span> <span class=\"comment\"># Page | Post | All. Default post<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">prism:<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">enable:<\/span> <span class=\"literal\">false<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">line_number:<\/span> <span class=\"literal\">true<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">theme:<\/span> <span class=\"string\">default<\/span><\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h4 id=\"\u672c\u5730\u8c03\u8bd5\">\u672c\u5730\u8c03\u8bd5<\/h4>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">hexo s --debug<\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># \u786e\u8ba4\u7ad9\u70b9\u529f\u80fd\u6b63\u5e38<\/span><\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 id=\"\u5c06\u7ad9\u70b9\u6587\u4ef6\u5939\u4e0a\u4f20\u5230-Github\">\u5c06\u7ad9\u70b9\u6587\u4ef6\u5939\u4e0a\u4f20\u5230 Github<\/h3>\n<h4 id=\"\u5728\u672c\u5730\u521d\u59cb\u5316-git\">\u5728\u672c\u5730\u521d\u59cb\u5316 git<\/h4>\n<p>\u7531\u4e8e\u6211\u662f\u5728 CI \u9636\u6bb5\u4ece\u7f51\u7edc\u76f4\u63a5 clone \u6574\u4e2a\u4e3b\u9898\uff0c\u6240\u4ee5\u6211\u5c31\u5c06 <code>themes\/<\/code> \u52a0\u5165\u4e86 <code>.gitignore<\/code>\uff0c\u6240\u4ee5\u8fd9\u91cc\u4f60\u8fd8\u8981\u5c06\u4e3b\u9898\u7684\u914d\u7f6e\u6587\u4ef6\u590d\u5236\u5230\u7ad9\u70b9\u6839\u76ee\u5f55\u5185\uff0c\u4e4b\u540e CI \u9636\u6bb5\u518d\u5c06\u5176\u653e\u56de\u539f\u4f4d\u7f6e\u3002(\u5982\u679c\u4f60\u7528\u7684\u4e3b\u9898\u6709\u5176\u4ed6\u7684\u914d\u7f6e\u6587\u4ef6\u65f6\u5e94\u8be5\u4e00\u5e76\u590d\u5236\u5230\u7ad9\u70b9\u6839\u76ee\u5f55)<\/p>\n<p>\u590d\u5236\u4e00\u4efd\u4e3b\u9898\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">cp themes\/suka\/_config.yml  _config.theme.yml<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u521d\u59cb\u5316 git<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">git init<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u786e\u4fdd <code>.gitignore<\/code> \u5185\u6709\u4e0b\u9762\u7684\u5185\u5bb9 (\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\u7684\u8bdd\u53ef\u4ee5\u81ea\u5df1\u521b\u5efa)<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span>\r\n<span class=\"line\">6<\/span>\r\n<span class=\"line\">7<\/span>\r\n<span class=\"line\">8<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">.DS_Store<\/span>\r\n<span class=\"line\">Thumbs.db<\/span>\r\n<span class=\"line\">db.json<\/span>\r\n<span class=\"line\">*.<span class=\"built_in\">log<\/span><\/span>\r\n<span class=\"line\">node_modules\/<\/span>\r\n<span class=\"line\">public\/<\/span>\r\n<span class=\"line\">.deploy*\/<\/span>\r\n<span class=\"line\">themes\/<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h4 id=\"\u5728-Github-\u521b\u5efa-repo\">\u5728 Github \u521b\u5efa repo<\/h4>\n<p>\u65b0\u5efa\u4e00\u4e2a repo \u547d\u540d\u4e3a <strong>username.github.io<\/strong> (<code>username<\/code> \u662f\u4f60\u7684 Github \u8d26\u6237\u540d\u79f0)<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span>\r\n<span class=\"line\">6<\/span>\r\n<span class=\"line\">7<\/span>\r\n<span class=\"line\">8<\/span>\r\n<span class=\"line\">9<\/span>\r\n<span class=\"line\">10<\/span>\r\n<span class=\"line\">11<\/span>\r\n<span class=\"line\">12<\/span>\r\n<span class=\"line\">13<\/span>\r\n<span class=\"line\">14<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"comment\"># \u6dfb\u52a0 Github \u4ed3\u5e93\u5230\u672c\u5730<\/span><\/span>\r\n<span class=\"line\">git remote add origin https:\/\/github.com\/username\/username.github.io.git<\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># \u65b0\u5efa\u4e00\u4e2a\u540d\u4e3a source \u7684\u5206\u652f<\/span><\/span>\r\n<span class=\"line\">git checkout -b <span class=\"built_in\">source<\/span><\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># \u5c06\u6240\u6709\u6587\u4ef6\u6dfb\u52a0\u5230 git<\/span><\/span>\r\n<span class=\"line\">git add .<\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># \u6dfb\u52a0 commit<\/span><\/span>\r\n<span class=\"line\">git commit -m <span class=\"string\">\"initial\"<\/span><\/span>\r\n\r\n<span class=\"line\"><span class=\"comment\"># \u5c06\u672c\u5730\u7684\u6587\u4ef6\u63a8\u9001\u5230 Github \u4e0a\u7684 source \u5206\u652f<\/span><\/span>\r\n<span class=\"line\">git push -u origin <span class=\"built_in\">source<\/span><\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u5982\u679c\u64cd\u4f5c\u4e0a\u6ca1\u6709\u95ee\u9898\u4f60\u4e0a\u4f20\u4e4b\u540e repo \u91cc\u9762\u7684\u6587\u4ef6\u5e94\u8be5\u5dee\u4e0d\u591a\u662f\u8fd9\u6837\u7684<\/p>\n<figure class=\"highlight plain\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span>\r\n<span class=\"line\">6<\/span>\r\n<span class=\"line\">7<\/span>\r\n<span class=\"line\">8<\/span>\r\n<span class=\"line\">9<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\">.<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 _config.theme.yml<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 _config.yml<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 .git<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 .gitignore<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 package.json<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 package-lock.json<\/span>\r\n<span class=\"line\">\u251c\u2500\u2500 scaffolds<\/span>\r\n<span class=\"line\">\u2514\u2500\u2500 source<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 id=\"\u914d\u7f6e-Travis-CI\">\u914d\u7f6e Travis CI<\/h3>\n<ol>\n<li>\u5c06 <a href=\"https:\/\/github.com\/marketplace\/travis-ci\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Travis CI<\/a> \u6dfb\u52a0\u5230\u4f60\u7684 Github \u8d26\u6237<\/li>\n<li>\u53bb <a href=\"https:\/\/github.com\/settings\/installations\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Applications settings<\/a> \u8bbe\u7f6e\u8ba9 <strong>Travis CI<\/strong> \u80fd\u591f\u8bbf\u95ee\u4f60\u7684 repo<\/li>\n<li>\u53bb <a href=\"https:\/\/github.com\/settings\/tokens\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Personal access tokens<\/a> \u4e3a <strong>Travis CI<\/strong> \u65b0\u5efa\u4e00\u4e2a token ( <strong>\u53ea\u9700\u8981 <code>repo<\/code> \u8fd9\u4e2a scopes<\/strong> )\uff0c\u7136\u540e<strong>\u628a token \u7684\u503c\u8bb0\u5f55\u4e0b\u6765<\/strong><\/li>\n<li>\u53bb <a href=\"https:\/\/travis-ci.com\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Travis CI<\/a>\uff0c\u5728\u4f60\u7684 repo \u9875\u9762\u4e0b\u70b9\u51fb <strong>More Options<\/strong> \u627e\u5230 <strong>Settings<\/strong>\uff0c \u7136\u540e\u627e\u5230 <strong>Environment Variables<\/strong>\uff0c\u5efa\u7acb\u4e00\u4e2a\u540d(NAME)\u4e3a <strong><code>GH_TOKEN<\/code><\/strong>, \u503c( VALUE )\u4e3a\u4f60<strong>\u4e0a\u4e00\u6b65\u8bb0\u5f55\u7684 token<\/strong>\uff0c\u6700\u540e\u4fdd\u5b58<\/li>\n<li>\u5728\u4f60\u7684 Github \u7684\u9879\u76ee source \u5206\u652f\u5185\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3a <code>.travis.yml<\/code> \u7684\u6587\u4ef6\uff0c\u53c2\u8003\u4ee5\u4e0b\u5185\u5bb9\u8fdb\u884c\u586b\u5165\uff0c(\u6211\u90fd\u6709\u6ce8\u91ca\uff0c\u4e0d\u8981\u7167\u6284)<\/li>\n<\/ol>\n<figure class=\"highlight yml\">\n<table>\n<tbody>\n<tr>\n<td class=\"gutter\">\n<pre><span class=\"line\">1<\/span>\r\n<span class=\"line\">2<\/span>\r\n<span class=\"line\">3<\/span>\r\n<span class=\"line\">4<\/span>\r\n<span class=\"line\">5<\/span>\r\n<span class=\"line\">6<\/span>\r\n<span class=\"line\">7<\/span>\r\n<span class=\"line\">8<\/span>\r\n<span class=\"line\">9<\/span>\r\n<span class=\"line\">10<\/span>\r\n<span class=\"line\">11<\/span>\r\n<span class=\"line\">12<\/span>\r\n<span class=\"line\">13<\/span>\r\n<span class=\"line\">14<\/span>\r\n<span class=\"line\">15<\/span>\r\n<span class=\"line\">16<\/span>\r\n<span class=\"line\">17<\/span>\r\n<span class=\"line\">18<\/span>\r\n<span class=\"line\">19<\/span>\r\n<span class=\"line\">20<\/span>\r\n<span class=\"line\">21<\/span>\r\n<span class=\"line\">22<\/span>\r\n<span class=\"line\">23<\/span>\r\n<span class=\"line\">24<\/span>\r\n<span class=\"line\">25<\/span>\r\n<span class=\"line\">26<\/span>\r\n<span class=\"line\">27<\/span>\r\n<span class=\"line\">28<\/span>\r\n<span class=\"line\">29<\/span>\r\n<span class=\"line\">30<\/span>\r\n<span class=\"line\">31<\/span>\r\n<span class=\"line\">32<\/span><\/pre>\n<\/td>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"attr\">os:<\/span> <span class=\"string\">linux<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">language:<\/span> <span class=\"string\">node_js<\/span> <\/span>\r\n<span class=\"line\"><span class=\"attr\">node_js:<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"number\">10<\/span>  <span class=\"comment\"># \u4f7f\u7528 nodejs LTS v10<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">branches:<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">only:<\/span><\/span>\r\n<span class=\"line\">    <span class=\"bullet\">-<\/span> <span class=\"string\">source<\/span> <span class=\"comment\"># \u53ea\u76d1\u63a7 source \u7684 branch<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">cache:<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">directories:<\/span><\/span>\r\n<span class=\"line\">    <span class=\"bullet\">-<\/span> <span class=\"string\">node_modules<\/span> <span class=\"comment\"># \u7f13\u5b58 node_modules \u52a0\u5feb\u6784\u5efa\u901f\u5ea6<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">before_script:<\/span> <span class=\"comment\">## \u6839\u636e\u4f60\u6240\u7528\u7684\u4e3b\u9898\u548c\u81ea\u5b9a\u4e49\u7684\u4e0d\u540c\uff0c\u8fd9\u91cc\u4f1a\u6709\u6240\u4e0d\u540c<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">npm<\/span> <span class=\"string\">install<\/span> <span class=\"string\">-g<\/span> <span class=\"string\">hexo-cli<\/span> <span class=\"comment\"># \u5728 CI \u73af\u5883\u5185\u5b89\u88c5 Hexo<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">mkdir<\/span> <span class=\"string\">themes<\/span> <span class=\"comment\"># \u7531\u4e8e\u6211\u4eec\u6ca1\u6709\u5c06 themes\/ \u4e0a\u4f20\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u65b0\u5efa\u4e00\u4e2a<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">cd<\/span> <span class=\"string\">themes<\/span> <\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">git<\/span> <span class=\"string\">clone<\/span> <span class=\"string\">https:\/\/github.com\/SukkaW\/hexo-theme-suka.git<\/span> <span class=\"string\">suka<\/span> <span class=\"comment\">#\u4ece Github \u4e0a\u62c9\u53d6 Suka \u4e3b\u9898<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">cd<\/span> <span class=\"string\">suka<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">npm<\/span> <span class=\"string\">install<\/span> <span class=\"string\">--production<\/span> <span class=\"comment\"># \u5b89\u88c5 Suka \u4e3b\u9898\u7684\u4f9d\u8d56<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">cd<\/span> <span class=\"string\">..\/..<\/span> <span class=\"comment\"># \u8fd4\u56de\u7ad9\u70b9\u6839\u76ee\u5f55<\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">cp<\/span> <span class=\"string\">_config.theme.yml<\/span> <span class=\"string\">themes\/suka\/_config.yml<\/span> <span class=\"comment\"># \u5c06\u4e3b\u9898\u7684\u914d\u7f6e\u6587\u4ef6\u653e\u56de\u539f\u5904    <\/span><\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">npm<\/span> <span class=\"string\">install<\/span> <span class=\"comment\"># \u5728\u6839\u76ee\u5f55\u5b89\u88c5\u7ad9\u70b9\u9700\u8981\u7684\u4f9d\u8d56 <\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">script:<\/span> <\/span>\r\n<span class=\"line\">  <span class=\"bullet\">-<\/span> <span class=\"string\">hexo<\/span> <span class=\"string\">generate<\/span> <span class=\"comment\"># generate static files<\/span><\/span>\r\n<span class=\"line\"><span class=\"attr\">deploy:<\/span> <span class=\"comment\"># \u6839\u636e\u4e2a\u4eba\u60c5\u51b5\uff0c\u8fd9\u91cc\u4f1a\u6709\u6240\u4e0d\u540c<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">provider:<\/span> <span class=\"string\">pages<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">skip_cleanup:<\/span> <span class=\"literal\">true<\/span> <span class=\"comment\"># \u6784\u5efa\u5b8c\u6210\u540e\u4e0d\u6e05\u9664<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">token:<\/span> <span class=\"string\">$GH_TOKEN<\/span> <span class=\"comment\"># \u4f60\u521a\u521a\u8bbe\u7f6e\u7684 token<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">keep_history:<\/span> <span class=\"literal\">true<\/span> <span class=\"comment\"># \u4fdd\u5b58\u5386\u53f2<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">fqdn:<\/span> <span class=\"string\">blog.ne0ng.page<\/span> <span class=\"comment\"># \u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u4f7f\u7528 username.github.io \u53ef\u5220\u9664<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">on:<\/span><\/span>\r\n<span class=\"line\">    <span class=\"attr\">branch:<\/span> <span class=\"string\">source<\/span> <span class=\"comment\"># hexo \u7ad9\u70b9\u6e90\u6587\u4ef6\u6240\u5728\u7684 branch<\/span><\/span>\r\n<span class=\"line\">  <span class=\"attr\">local_dir:<\/span> <span class=\"string\">public<\/span> <\/span>\r\n<span class=\"line\">  <span class=\"attr\">target_branch:<\/span> <span class=\"string\">master<\/span> <span class=\"comment\"># \u5b58\u653e\u751f\u6210\u7ad9\u70b9\u6587\u4ef6\u7684 branch\uff0c\u4f7f\u7528 username.github.io \u5fc5\u987b\u662f master<\/span><\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<ol start=\"6\">\n<li>\u5f53\u4f60\u4fdd\u5b58\u4e4b\u540e\uff0c Travis CI \u4fbf\u4f1a\u5f00\u59cb\u90e8\u7f72\uff0c \u5b83\u5b8c\u6210\u4e4b\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728\u4f60\u7684 repo \u91cc <code>master<\/code> \u5206\u652f\u67e5\u770b\u5230\u751f\u6210\u7684\u7ad9\u70b9\u6587\u4ef6<\/li>\n<li>\u8fd9\u65f6\u4f60\u5e94\u8be5\u5c31\u53ef\u4ee5\u8bbf\u95ee <a href=\"https:\/\/username.github.io\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">https:\/\/username.github.io<\/a> \u67e5\u770b\u4f60\u7684\u7ad9\u70b9\u4e86<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Travis CI \u52a0 Hexo &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/43403"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43403"}],"version-history":[{"count":2,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/43403\/revisions"}],"predecessor-version":[{"id":43458,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/43403\/revisions\/43458"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43403"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}