Commit 14815537 authored by John's avatar John

Site updated: 2018-11-02 14:17:11

parent 390d56f7
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<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…"> <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…">
<meta property="og:locale" content="en"> <meta property="og:locale" content="en">
<meta property="og:image" content="http://blog.thebestjohn.com/images/gitlabrunner/runner.png"> <meta property="og:image" content="http://blog.thebestjohn.com/images/gitlabrunner/runner.png">
<meta property="og:updated_time" content="2018-11-02T13:35:56.669Z"> <meta property="og:updated_time" content="2018-11-02T14:16:15.769Z">
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Setting up Hexo Auto-deploy from Gitlab"> <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…"> <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…">
...@@ -99,31 +99,32 @@ ...@@ -99,31 +99,32 @@
</header> </header>
<section class="terminal"> <section class="terminal">
<div class="history"> <div class="history">
<span data-strings="ssh-keygen -t rsa ~/runnerboi^200" data-action="type" data-delay="1000">$ ssh-keygen -t rsa ~/runnerboi<br></span> <span data-strings="ssh-keygen -t rsa -f ~/runnerboi -C runnerboi@gitlab^200" data-action="type" data-delay="1000">$ ssh-keygen -t rsa -f ~/runnerboi -C runnerboi@gitlab<br></span>
<span data-strings="Generating public/private rsa key pair." data-action="print" data-delay="2000">Generating public/private rsa key pair.<br></span> <span data-strings="Generating public/private rsa key pair." data-action="print" data-delay="2000">Generating public/private rsa key pair.<br></span>
<span data-prompt="Enter a passphrase(empty for no passphrase):" data-strings="" data-action="prompt" data-delay="3000">Enter a passphrase(empty for no passphrase):<br></span> <span data-prompt="Enter a passphrase(empty for no passphrase):" data-strings="" data-action="prompt" data-delay="3000">Enter a passphrase(empty for no passphrase):<br></span>
<span data-prompt="Enter same passphrase again:" data-strings="" data-action="prompt" data-delay="2000">Enter same passphrase again:<br></span> <span data-prompt="Enter same passphrase again:" data-strings="" data-action="prompt" data-delay="2000">Enter same passphrase again:<br></span>
<span data-strings="Your identification has been saved in /Users/john/testtt.<br>Your public key has been saved in /Users/john/testtt.pub.<br>The key fingerprint is:<br>SHA256:wdsn98Q+L96juYXdPFHZ/UN3ucpfO7CqOqwornyNavI<br/>The key's randomart image is:<br/>+---[RSA 2048]----+<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+*|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;..&nbsp;*|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S&nbsp;o&nbsp;o&nbsp;o+.|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+.=+.+|<br>|&nbsp;&nbsp;&nbsp;&nbsp;o&nbsp;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+*++|<br>|oo&nbsp;o..&nbsp;o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.=*+|<br>|*=E.&nbsp;...o....=++=|<br>+----[SHA256]-----+" <span data-strings="Your identification has been saved in /Users/john/testtt.<br>Your public key has been saved in /Users/john/testtt.pub.<br>The key fingerprint is:<br>SHA256:j+FL93E5e6btfzLZxkrWrZdrBkwqanJQtba1RZwROO8 runnerboi@gitlab<br/>The key's randomart image is:<br/>+---[RSA&nbsp;2048]----+<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oo+&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;o&nbsp;+&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;.&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;o&nbsp;.&nbsp;+&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;S&nbsp;o&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;.&nbsp;*&nbsp;o&nbsp;E&nbsp;o.|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;=&nbsp;+&nbsp;.&nbsp;B++|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;=&nbsp;o&nbsp;.&nbsp;=+OO|<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;.&nbsp;&nbsp;&nbsp;.&nbsp;B%B|<br>+----[SHA256]-----+"
data-action="print" data-delay="0"> data-action="print" data-delay="0">
Your identification has been saved in /Users/john/testtt.<br> Your identification has been saved in /Users/john/testtt.<br>
Your public key has been saved in /Users/john/testtt.pub.<br> Your public key has been saved in /Users/john/testtt.pub.<br>
The key fingerprint is:<br> The key fingerprint is:<br>
SHA256:wdsn98Q+L96juYXdPFHZ/UN3ucpfO7CqOqwornyNavI<br> SHA256:j+FL93E5e6btfzLZxkrWrZdrBkwqanJQtba1RZwROO8 runnerboi@gitlab<br>
The key's randomart image is:<br> The key's randomart image is:<br>
+---[RSA 2048]----+<br> +---[RSA&nbsp;2048]----+<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oo+&nbsp;&nbsp;|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;o&nbsp;+&nbsp;&nbsp;&nbsp;|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+*|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;.&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;..&nbsp;*|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;o&nbsp;.&nbsp;+&nbsp;&nbsp;&nbsp;|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S&nbsp;o&nbsp;o&nbsp;o+.|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;S&nbsp;o&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+.=+.+|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;.&nbsp;*&nbsp;o&nbsp;E&nbsp;o.|<br>
|&nbsp;&nbsp;&nbsp;&nbsp;o&nbsp;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+*++|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;=&nbsp;+&nbsp;.&nbsp;B++|<br>
|oo&nbsp;o..&nbsp;o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.=*+|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;=&nbsp;o&nbsp;.&nbsp;=+OO|<br>
|*=E.&nbsp;...o....=++=|<br> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;.&nbsp;&nbsp;&nbsp;.&nbsp;B%B|<br fix="*">
+----[SHA256]-----+<br></span> +----[SHA256]-----+<br></span>
<span data-strings="^3000cat ~/runnerboi.pub^600" data-action="type" data-delay="1000">$ cat ~/runnerboi.pub<br></span> <span data-strings="^3000cat ~/runnerboi.pub^600" data-action="type" data-delay="1000">$ cat ~/runnerboi.pub<br></span>
<span data-strings="3458023475908759-83-g98h1349-7fh53-97vh259-vu7hsdfivub1ijbhflkgbjh3597tyvhyb3ui1ygt807gh38047glsfaraweg4" data-action="print">3458023475908759-83-g98h1349-7fh53-97vh259-vu7hsdfivub1ijbhflkgbjh3597tyvhyb3ui1ygt807gh38047glsfaraweg4</span> <span data-strings="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXnZZ0e0BKqH6i15DL+RO68paFABpXH+alHpAuyrhn3dtbPX0lOQJF275kt/qn8wwDRYAQvdWeTGynmj5d5ul1Fo+ONK+kPvAjX1WZowLEjsewWTHC1Qf0CtYphGoXoc1XRNPTu+wW3xPOCQQwz/gnqJeUw9bNpdj+qAo6JCkqnEb7eXWYfNWBckqgPx3R+hVDlrZxDGxoFOHQ06Wp3UkoWV5LUE1++0akjpIApU0pduX1wnBFCVH183oYuOeSftqYx7MBBGlsLO1+WNmOdaFSGqRLkrDT8e95NGdIGZuGovIRHwq+InnYOghOYQYRhgenaZw4u9Rf5hvVCMcvHHd1 runnerboi@gitlab"
data-action="print">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXnZZ0e0BKqH6i15DL+RO68paFABpXH+alHpAuyrhn3dtbPX0lOQJF275kt/qn8wwDRYAQvdWeTGynmj5d5ul1Fo+ONK+kPvAjX1WZowLEjsewWTHC1Qf0CtYphGoXoc1XRNPTu+wW3xPOCQQwz/gnqJeUw9bNpdj+qAo6JCkqnEb7eXWYfNWBckqgPx3R+hVDlrZxDGxoFOHQ06Wp3UkoWV5LUE1++0akjpIApU0pduX1wnBFCVH183oYuOeSftqYx7MBBGlsLO1+WNmOdaFSGqRLkrDT8e95NGdIGZuGovIRHwq+InnYOghOYQYRhgenaZw4u9Rf5hvVCMcvHHd1 runnerboi@gitlab</span>
<span data-action="empty"></span> <span data-action="empty"></span>
</div> </div>
...@@ -221,6 +222,7 @@ ...@@ -221,6 +222,7 @@
</section> </section>
</div> </div>
</p> </p>
<p>Feel free to name it, tag it, describe it however you want but make sure you put shell as the executor.</p>
<h3 id="Useful-docker-commands"><a href="#Useful-docker-commands" class="headerlink" title="Useful docker commands"></a>Useful docker commands</h3> <h3 id="Useful-docker-commands"><a href="#Useful-docker-commands" class="headerlink" title="Useful docker commands"></a>Useful docker commands</h3>
<p><strong>Blow away the container</strong><br> <p><strong>Blow away the container</strong><br>
<figure class="highlight bash"> <figure class="highlight bash">
...@@ -300,7 +302,7 @@ ...@@ -300,7 +302,7 @@
<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><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre> <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><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre>
</td> </td>
<td class="code"> <td class="code">
<pre><span class="line"><span class="attr">before_script:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">'which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )'</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">mkdir</span> <span class="bullet">-p</span> <span class="string">~/.ssh</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">chmod</span> <span class="number">700</span> <span class="string">~/.ssh</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">eval</span> <span class="string">$(ssh-agent</span> <span class="bullet">-s)</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">echo</span> <span class="bullet">-e</span> <span class="string">"$SSH_CONFIG"</span> <span class="string">&gt; ~/.ssh/config</span></span><br><span class="line"><span class="string"> - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - &gt; /dev/null</span></span><br><span class="line"><span class="string"> </span></span><br><span class="line"><span class="string"> - 'nvm --version|| curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash'</span></span><br><span class="line"><span class="string"> - 'export NVM_DIR="$HOME/.nvm"'</span></span><br><span class="line"><span class="string"> - '[ -s "$NVM_DIR/nvm.sh" ] &amp;&amp; \. "$NVM_DIR/nvm.sh"'</span></span><br><span class="line"><span class="string"> - 'npm -v || nvm install --lts'</span></span><br><span class="line"><span class="string"> </span></span><br><span class="line"><span class="string"> - echo $PATH</span></span><br><span class="line"><span class="string"> - npm install -g hexo-cli # Install Hexo itself</span></span><br><span class="line"><span class="string"> - npm install # Install Hexo modules and dependencies</span></span><br><span class="line"><span class="string"> - npm ls --depth 0 || true #List all the plugins</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span><span class="attr">pages:</span></span><br><span class="line"><span class="attr"> cache:</span></span><br><span class="line"><span class="attr"> paths:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">node_modules/</span></span><br><span class="line"> </span><br><span class="line"><span class="attr"> script:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">config</span> <span class="bullet">--global</span> <span class="string">user.email</span> <span class="string">"[email protected]"</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">config</span> <span class="bullet">--global</span> <span class="string">user.name</span> <span class="string">"John"</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">clean</span> <span class="comment">#clean up all the files, we want a full build!</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">clone</span> <span class="string">[email protected]:TheBestJohn/blog.git</span> <span class="string">./.deploy_git</span> <span class="comment">#Checkout current build so we have continuation</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">generate</span> <span class="bullet">--debug</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">deploy</span> <span class="comment"># This will use the hexo git deploy method.</span></span><br><span class="line"><span class="attr"> artifacts:</span></span><br><span class="line"><span class="attr"> paths:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">public</span> <span class="comment">#Let's also compress our output and re-upload as an artifact</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">debug.log</span> <span class="comment">#As well as a log in case anything goes wrong.</span></span><br><span class="line"><span class="attr"> only:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">master</span></span><br></pre> <pre><span class="line"><span class="attr">before_script:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">'which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )'</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">mkdir</span> <span class="bullet">-p</span> <span class="string">~/.ssh</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">chmod</span> <span class="number">700</span> <span class="string">~/.ssh</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">eval</span> <span class="string">$(ssh-agent</span> <span class="bullet">-s)</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">echo</span> <span class="bullet">-e</span> <span class="string">"$SSH_CONFIG"</span> <span class="string">&gt; ~/.ssh/config</span></span><br><span class="line"><span class="string"> - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - &gt; /dev/null</span></span><br><span class="line"><span class="string"> </span></span><br><span class="line"><span class="string"> - 'nvm --version|| curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash'</span></span><br><span class="line"><span class="string"> - 'export NVM_DIR="$HOME/.nvm"'</span></span><br><span class="line"><span class="string"> - '[ -s "$NVM_DIR/nvm.sh" ] &amp;&amp; \. "$NVM_DIR/nvm.sh"'</span></span><br><span class="line"><span class="string"> - 'npm -v || nvm install --lts'</span></span><br><span class="line"><span class="string"> </span></span><br><span class="line"><span class="string"> - echo $PATH</span></span><br><span class="line"><span class="string"> - npm install -g hexo-cli # Install Hexo itself</span></span><br><span class="line"><span class="string"> - npm install # Install Hexo modules and dependencies</span></span><br><span class="line"><span class="string"> - npm ls --depth 0 || true #List all the plugins</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span><span class="attr">public:</span></span><br><span class="line"><span class="attr"> cache:</span></span><br><span class="line"><span class="attr"> paths:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">node_modules/</span></span><br><span class="line"> </span><br><span class="line"><span class="attr"> script:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">config</span> <span class="bullet">--global</span> <span class="string">user.email</span> <span class="string">"[email protected]"</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">config</span> <span class="bullet">--global</span> <span class="string">user.name</span> <span class="string">"John"</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">clean</span> <span class="comment">#clean up all the files, we want a full build!</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">git</span> <span class="string">clone</span> <span class="string">[email protected]:TheBestJohn/blog.git</span> <span class="string">./.deploy_git</span> <span class="comment">#Checkout current build so we have continuation</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">generate</span> <span class="bullet">--debug</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">hexo</span> <span class="string">deploy</span> <span class="comment"># This will use the hexo git deploy method.</span></span><br><span class="line"><span class="attr"> artifacts:</span></span><br><span class="line"><span class="attr"> paths:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">public</span> <span class="comment">#Let's also compress our output and re-upload as an artifact</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">debug.log</span> <span class="comment">#As well as a log in case anything goes wrong.</span></span><br><span class="line"><span class="attr"> only:</span></span><br><span class="line"><span class="bullet"> -</span> <span class="string">master</span></span><br></pre>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -318,7 +320,7 @@ ...@@ -318,7 +320,7 @@
<li>Installing all the packages we need for our blog.</li> <li>Installing all the packages we need for our blog.</li>
</ul> </ul>
<h4 id="pages"><a href="#pages" class="headerlink" title="pages"></a>pages</h4> <h4 id="pages"><a href="#pages" class="headerlink" title="pages"></a>pages</h4>
<p>We’ve called our job “pages” here. You could write anything here and that’s what the job bould be named. In the “script” part of this, we’re:</p> <p>We’ve called our job “public” here. You could write anything here and that’s what the job would be named. In the “script” part of this, we’re:</p>
<ul> <ul>
<li>configuring our git user</li> <li>configuring our git user</li>
<li>running a cleanup of any files left around.</li> <li>running a cleanup of any files left around.</li>
...@@ -327,17 +329,27 @@ ...@@ -327,17 +329,27 @@
<li>Running a deploy which we set up in the hexo <code>._config.yml</code> file. </li> <li>Running a deploy which we set up in the hexo <code>._config.yml</code> file. </li>
</ul> </ul>
<p>Artifacts refer to files that get saved when a job completes and are sent back to the repo as a file. Here, we basically copy the public directory and the debug log. This I’ll be using for something in another future post. </p> <p>Artifacts refer to files that get saved when a job completes and are sent back to the repo as a file. Here, we basically copy the public directory and the debug log. This I’ll be using for something in another future post. </p>
<p>The “only” part of this will make it only run the “public” scripts when we commit to master.</p>
<h2 id="Using-it"><a href="#Using-it" class="headerlink" title="Using it."></a>Using it.</h2> <h2 id="Using-it"><a href="#Using-it" class="headerlink" title="Using it."></a>Using it.</h2>
<p>But really, I don’t want to have it build every commit… Sometimes I’m just editing drafts and literally nothing will change on the frontend. Well as of right now you need to add <code>[ci-skip]</code> to the commit message for that to happen. <p>Now we’re set up to run our build when we commit to blogsource. Commit these files and the CI should jump into action trying to build your site. Once it’s done, check your “blog” repo and you should have all your files nice and tidy. From
here you can do a git clone or git pull on your live server and your site will be updated. I’m working on making this part more automated for a future post but if you’re impatient you could try something like they did in <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps"
rel="external nofollow noopener noreferrer" target="_blank">this post on digital ocean</a>.</p>
<p>Really though, I don’t want to have it build every commit. Sometimes I’m just editing drafts and literally nothing will change on the frontend. Well as of right now you need to add <code>[ci-skip]</code> to the commit message for that to happen.
Gitlab just recently started supporting push options. These allow you to pass options to your repo without fouling up your commit messages with a soup of tags and variables. There’s ongoing work in <a href="https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15643/commits" Gitlab just recently started supporting push options. These allow you to pass options to your repo without fouling up your commit messages with a soup of tags and variables. There’s ongoing work in <a href="https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15643/commits"
rel="external nofollow noopener noreferrer" target="_blank">this merge request</a> to implement that with <code>git push -o ci-skip</code>. Pretty interesting!</p> rel="external nofollow noopener noreferrer" target="_blank">this merge request</a> to implement that with <code>git push -o ci-skip</code>. Pretty interesting!</p>
<p><a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/14499" rel="external nofollow noopener noreferrer" target="_blank">https://gitlab.com/gitlab-org/gitlab-ce/issues/14499</a><br><a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/18667" <p><a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/14499" rel="external nofollow noopener noreferrer" target="_blank">https://gitlab.com/gitlab-org/gitlab-ce/issues/14499</a><br><a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/18667"
rel="external nofollow noopener noreferrer" target="_blank">https://gitlab.com/gitlab-org/gitlab-ce/issues/18667</a></p> rel="external nofollow noopener noreferrer" target="_blank">https://gitlab.com/gitlab-org/gitlab-ce/issues/18667</a></p>
<p>useful links<br><a href="https://gitlab.com/themes-templates/hexo/blob/master/.gitlab-ci.yml" rel="external nofollow noopener noreferrer" target="_blank">https://gitlab.com/themes-templates/hexo/blob/master/.gitlab-ci.yml</a><br><a href="https://docs.gitlab.com/ee/administration/custom_hooks.html" <h2 id="That’s-all-folks"><a href="#That’s-all-folks" class="headerlink" title="That’s all folks!"></a>That’s all folks!</h2>
rel="external nofollow noopener noreferrer" target="_blank">https://docs.gitlab.com/ee/administration/custom_hooks.html</a><br><a href="https://gitlab.com/webhook-to-mqtt/webhook-to-mqtt-server" rel="external nofollow noopener noreferrer" <p>As always, if you have any questions, just drop me a line and I’ll do my best to get you some answers. Have fun, keep making cool stuff and I’ll see you on the next project!</p>
target="_blank">https://gitlab.com/webhook-to-mqtt/webhook-to-mqtt-server</a><br> <!-- useful links
<a href="https://docs.gitlab.com/runner/register/index.html#docker" rel="external nofollow noopener noreferrer" target="_blank">https://docs.gitlab.com/runner/register/index.html#docker</a><br><a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps" https://gitlab.com/themes-templates/hexo/blob/master/.gitlab-ci.yml
rel="external nofollow noopener noreferrer" target="_blank">https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps</a></p> https://docs.gitlab.com/ee/administration/custom_hooks.html
https://gitlab.com/webhook-to-mqtt/webhook-to-mqtt-server
https://docs.gitlab.com/runner/register/index.html#docker
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html
-->
</div> </div>
<div class="article__author" itemscope="" itemprop="author" itemtype="https://schema.org/Person"><img class="article__author__image" src="/images/avatar.jpg" alt="John Warren"><a class="article__author__link" title="About John Warren" rel="author">John Warren</a> <div class="article__author" itemscope="" itemprop="author" itemtype="https://schema.org/Person"><img class="article__author__image" src="/images/avatar.jpg" alt="John Warren"><a class="article__author__link" title="About John Warren" rel="author">John Warren</a>
<p class="article__author__desc">Just a place to make stuff</p> <p class="article__author__desc">Just a place to make stuff</p>
...@@ -364,7 +376,7 @@ ...@@ -364,7 +376,7 @@
})(); })();
</script><noscript>Enable JavaScript to see comments.</noscript> </script><noscript>Enable JavaScript to see comments.</noscript>
<!-- Meta Tags for Structured Data--> <!-- Meta Tags for Structured Data-->
<meta itemprop="dateModified" content="2018-11-02T13:35:56.669Z"> <meta itemprop="dateModified" content="2018-11-02T14:16:15.769Z">
<meta itemprop="articleBody" 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 <meta itemprop="articleBody" 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..."> basically post...">
<meta itemprop="url" content="/posts/setting-up-hexo-auto-deploy-from-gitlab/"> <meta itemprop="url" content="/posts/setting-up-hexo-auto-deploy-from-gitlab/">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<url> <url>
<loc>http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/</loc> <loc>http://blog.thebestjohn.com/posts/setting-up-hexo-auto-deploy-from-gitlab/</loc>
<lastmod>2018-11-02T13:35:56.669Z</lastmod> <lastmod>2018-11-02T14:16:15.769Z</lastmod>
</url> </url>
...@@ -44,14 +44,14 @@ ...@@ -44,14 +44,14 @@
</url> </url>
<url> <url>
<loc>http://blog.thebestjohn.com/posts/table-based-design/</loc> <loc>http://blog.thebestjohn.com/posts/the-plasma-speaker-saga-pt-iii/</loc>
<lastmod>2018-10-30T19:10:38.180Z</lastmod> <lastmod>2018-10-30T19:10:38.180Z</lastmod>
</url> </url>
<url> <url>
<loc>http://blog.thebestjohn.com/posts/the-plasma-speaker-saga-pt-iii/</loc> <loc>http://blog.thebestjohn.com/posts/table-based-design/</loc>
<lastmod>2018-10-30T19:10:38.180Z</lastmod> <lastmod>2018-10-30T19:10:38.180Z</lastmod>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment