Site updated: 2018-04-27 17:30:30
Showing
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <!-- so meta --> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
| <meta name="HandheldFriendly" content="True"> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> | |||
| <meta name="description" content="In a previous post I talked about why I like the idea of a static site generator, and the reasons for choosing to use one. In this post I want to share how I got mine set up to basically post everythi"> | |||
| <meta property="og:type" content="article"> | |||
| <meta property="og:title" content="Setting up Hexo Auto-deploy from Gitlab"> | |||
| <meta property="og:url" content="http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/index.html"> | |||
| <meta property="og:site_name" content="TheBestJohn"> | |||
| <meta property="og:description" content="In a previous post I talked about why I like the idea of a static site generator, and the reasons for choosing to use one. In this post I want to share how I got mine set up to basically post everythi"> | |||
| <meta property="og:locale" content="default"> | |||
| <meta property="og:updated_time" content="2018-04-27T15:31:39.635Z"> | |||
| <meta name="twitter:card" content="summary"> | |||
| <meta name="twitter:title" content="Setting up Hexo Auto-deploy from Gitlab"> | |||
| <meta name="twitter:description" content="In a previous post I talked about why I like the idea of a static site generator, and the reasons for choosing to use one. In this post I want to share how I got mine set up to basically post everythi"> | |||
| <link rel="shortcut icon" href="/images/favicon.ico"> | |||
| <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192"> | |||
| <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png"> | |||
| <!-- title --> | |||
| <title>Setting up Hexo Auto-deploy from Gitlab</title> | |||
| <!-- styles --> | |||
| <link rel="stylesheet" href="/css/style.css"> | |||
| <!-- persian styles --> | |||
| <link rel="stylesheet" href="/css/rtl.css"> | |||
| <!-- rss --> | |||
| </head> | |||
| <body class="max-width mx-auto px3 ltr"> | |||
| <div id="header-post"> | |||
| <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a> | |||
| <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a> | |||
| <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a> | |||
| <span id="menu"> | |||
| <span id="nav"> | |||
| <ul> | |||
| <li><a href="/">Home</a></li> | |||
| <li><a href="/about/">About</a></li> | |||
| <li><a href="/archives/">Writing</a></li> | |||
| </ul> | |||
| </span> | |||
| <br/> | |||
| <span id="actions"> | |||
| <ul> | |||
| <li><a class="icon" href="/posts/static-site-what/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li> | |||
| <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li> | |||
| <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li> | |||
| </ul> | |||
| <span id="i-prev" class="info" style="display:none;">Previous post</span> | |||
| <span id="i-next" class="info" style="display:none;">Next post</span> | |||
| <span id="i-top" class="info" style="display:none;">Back to top</span> | |||
| <span id="i-share" class="info" style="display:none;">Share post</span> | |||
| </span> | |||
| <br/> | |||
| <div id="share" style="display: none"> | |||
| <ul> | |||
| <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/"><i class="fab fa-facebook " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://twitter.com/share?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&text=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-twitter " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&is_video=false&description=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="mailto:?subject=Setting up Hexo Auto-deploy from Gitlab&body=Check out this article: http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://getpocket.com/save?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://reddit.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-reddit " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://digg.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-digg " aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&name=Setting up Hexo Auto-deploy from Gitlab&description="><i class="fab fa-tumblr " aria-hidden="true"></i></a></li> | |||
| </ul> | |||
| </div> | |||
| <div id="toc"> | |||
| </div> | |||
| </span> | |||
| </div> | |||
| <div class="content index my4"> | |||
| <article class="post" itemscope itemtype="http://schema.org/BlogPosting"> | |||
| <header> | |||
| <h1 class="posttitle" itemprop="name headline"> | |||
| Setting up Hexo Auto-deploy from Gitlab | |||
| </h1> | |||
| <div class="meta"> | |||
| <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person"> | |||
| <span itemprop="name">TheBestJohn</span> | |||
| </span> | |||
| <div class="postdate"> | |||
| <time datetime="2018-04-30T17:40:00.000Z" itemprop="datePublished">2018-04-30</time> | |||
| </div> | |||
| </div> | |||
| </header> | |||
| <div class="content" itemprop="articleBody"> | |||
| <p>In a <a href="!--1--">previous post</a> I talked about why I like the idea of a static site generator, and the reasons for choosing to use one. In this post I want to share how <em>I</em> got mine set up to basically post everything with a single git push of the source. It may not be pretty, and it most certainly is not the best way to do it, but it works for me and the proof is in the pudding as it were.</p> | |||
| <p>Please also note that I am a total neophyte when it comes to the arcane art of <abbr title="Continuous Integration">CI</abbr> and automated testing.</p> | |||
| <p>To automatically commit to your static site repo when it’s deployed, edit the hexo project’s <code>_config.yml</code> with the following.<br><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Deployment</span></span><br><span class="line"><span class="comment">## Docs: https://hexo.io/docs/deployment.html</span></span><br><span class="line"><span class="attr">deploy:</span></span><br><span class="line"><span class="attr"> type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr"> branch:</span> <span class="string">master</span></span><br><span class="line"><span class="attr"> repo:</span> <span class="string">'[email protected]:staticblog.git'</span></span><br></pre></td></tr></table></figure></p> | |||
| <p>With this I used the <code>ssh</code> commit method so make sure you generate an rsa key and register it to your gitlab commit runner’s user.</p> | |||
| </div> | |||
| </article> | |||
| <div class="blog-post-comments"> | |||
| <div id="disqus_thread"> | |||
| <noscript>Please enable JavaScript to view the comments.</noscript> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="footer-post-container"> | |||
| <div id="footer-post"> | |||
| <div id="nav-footer" style="display: none"> | |||
| <ul> | |||
| <li><a href="/">Home</a></li> | |||
| <li><a href="/about/">About</a></li> | |||
| <li><a href="/archives/">Writing</a></li> | |||
| </ul> | |||
| </div> | |||
| <div id="toc-footer" style="display: none"> | |||
| </div> | |||
| <div id="share-footer" style="display: none"> | |||
| <ul> | |||
| <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://twitter.com/share?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&text=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&is_video=false&description=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="mailto:?subject=Setting up Hexo Auto-deploy from Gitlab&body=Check out this article: http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="https://getpocket.com/save?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://reddit.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://digg.com/submit?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&title=Setting up Hexo Auto-deploy from Gitlab"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li> | |||
| <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/&name=Setting up Hexo Auto-deploy from Gitlab&description="><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li> | |||
| </ul> | |||
| </div> | |||
| <div id="actions-footer"> | |||
| <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> Menu</a> | |||
| <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> TOC</a> | |||
| <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> Share</a> | |||
| <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> Top</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <footer id="footer"> | |||
| <div class="footer-left"> | |||
| Copyright © 2018 TheBestJohn | |||
| </div> | |||
| <div class="footer-right"> | |||
| <nav> | |||
| <ul> | |||
| <li><a href="/">Home</a></li> | |||
| <li><a href="/about/">About</a></li> | |||
| <li><a href="/archives/">Writing</a></li> | |||
| </ul> | |||
| </nav> | |||
| </div> | |||
| </footer> | |||
| </body> | |||
| </html> | |||
| <!-- styles --> | |||
| <link rel="stylesheet" href="/lib/font-awesome/css/fontawesome-all.min.css"> | |||
| <link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css"> | |||
| <!-- jquery --> | |||
| <script src="/lib/jquery/jquery.min.js"></script> | |||
| <script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script> | |||
| <script src="/js/main.js"></script> | |||
| <!-- search --> | |||
| <!-- Google Analytics --> | |||
| <!-- Baidu Analytics --> | |||
| <!-- Disqus Comments --> | |||
| <script type="text/javascript"> | |||
| var disqus_shortname = 'thebestjohn'; | |||
| (function(){ | |||
| var dsq = document.createElement('script'); | |||
| dsq.type = 'text/javascript'; | |||
| dsq.async = true; | |||
| dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | |||
| (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | |||
| }()); | |||
| </script> | |||
Please
register
or
sign in
to comment