Commit 8baaa096 authored by John's avatar John

Site updated: 2018-11-03 18:12:30

parent 1c5e735f
function Terminal(settings) {
this.prefixChar = settings.prompt || "";
this.cursorChar = settings.cursor || "|";
this.target = $(settings.target);
this.autoplay = settings.auto || true;
this.position = -1;
this.continue = true;
var script = []
this.target.find(".history").children("span").each(function(index) {
var datavals = $(this).data();
var scriptNode = {};
for (var key in datavals) {
scriptNode[key] = datavals[key];
// console.log(index+" : "+key + " : " + datavals[key]);
}
if (scriptNode.action) {
script.push(scriptNode);
}
})
this.script = script;
this.target.html("");
var head = $("<header>");
var button1 = $("<div>", {
"class": "button green"
});
head.append(button1);
var button2 = $("<div>", {
"class": "button yellow"
});
head.append(button2);
var button3 = $("<div>", {
"class": "button red"
});
head.append(button3);
this.target.append(head);
var sect = $("<section>", {
"class": "terminal"
});
var his = $("<div>", {
"class": "history"
});
sect.append(his);
var pre = $("<span>", {
"class": "prefix"
});
sect.append(pre);
this.promptName = "prompt" + Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
console.log(this.promptName);
var prom = $("<span>", {
"class": this.promptName
});
sect.append(prom);
this.target.append(sect);
this.prompt = this.target.find("." + this.promptName);
this.prefix = this.target.find(".prefix");
this.history = this.target.find(".history");
this.MoveToHis = function(callback) {
var history = this.history.html();
if (this.script[this.position]["action"] == "prompt") {
this.history.html(history + this.prefix.html() + this.prompt.html() + "<br>")
} else {
this.history.html(history + this.prefixChar + this.prompt.html() + "<br>")
}
this.position = this.position + 1;
this.prefix.html(this.prefixChar);
this.prompt.text("");
callback()
}
this.TypeCallback = function() {
if (this.position == -1) {
this.position = this.position + 1;
if (this.autoplay) {
this.Play()
}
return
}
var bound = this.Play.bind(this);
var hist = this.MoveToHis.bind(this);
var delay = parseInt(this.script[this.position].delay) || 1000;
setTimeout(function() {
hist(bound)
}, delay);
// $('section.terminal').scrollTop($('section.terminal').height());
}
this.maketyper = function() {
this.prefix.html(this.prefixChar);
var bound = this.TypeCallback.bind(this);
this.typer = new Typed("." + this.promptName, {
strings: [""],
cursorChar: this.cursorChar,
typeSpeed: 30,
onComplete: bound,
})
this.cursor = this.target.find(".typed-cursor");
}
this.maketyper();
this.Prompt = function() {
this.prefix.html(this.script[this.position].prompt);
this.prompt.removeData(); //cleanup
this.cursor.text('');
// console.log(this.script[this.position].prompt);
//
this.typer.strings = this.script[this.position]["strings"].split(':;');
this.typer.reset();
// this.prompt.html(this.script[this.position].prompt);
}
this.Print = function() {
this.prefix.html("");
this.prompt.removeData();
this.cursor.text('');
var history = this.history.html();
this.history.html(history + this.script[this.position]["strings"] + "<br>")
this.prompt.html();
var bound = this.Play.bind(this);
this.position = this.position + 1;
section = this.target.find("section");
section.scrollTop(section.height());
if (this.position < this.script.length) {
setTimeout(bound, this.script[this.position - 1].delay || 0);
}
}
this.Type = function() {
this.prefix.html(this.prefixChar);
this.prompt.removeData(); //cleanup
this.cursor.text('');
this.typer.strings = this.script[this.position]["strings"].split(':;');
this.typer.reset();
}
this.Empty = function() {
this.prefix.html(this.prefixChar);
this.prompt.removeData(); //cleanup
this.cursor.text('');
}
this.Test = function() {
this.Step(2)
}
this.Step = function(pos) {
this.continue = false
this.position = pos;
switch (this.script[this.position]["action"]) {
case "type":
this.Type()
break;
case "prompt":
this.Prompt();
break;
case "print":
this.Print();
break;
}
}
this.Restart = function() {
this.position = 0;
this.history.html("");
this.Play();
}
this.Play = function() {
// scroll to bottom of screen
section = this.target.find("section");
section.scrollTop(section.height());
if (this.position >= this.script.length - 1) {
this.position = 0;
var bound = this.Restart.bind(this);
setTimeout(bound, 15000);
return;
}
if (this.continue) {
switch (this.script[this.position]["action"]) {
case "type":
this.Type()
break;
case "prompt":
this.Prompt();
break;
case "print":
this.Print();
break;
case "empty":
this.Empty();
break;
}
}
}
}
\ No newline at end of file
...@@ -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-02T14:16:15.769Z"> <meta property="og:updated_time" content="2018-11-03T18:11:22.621Z">
<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…">
...@@ -204,15 +204,15 @@ ...@@ -204,15 +204,15 @@
</header> </header>
<section class="terminal"> <section class="terminal">
<div class="history"> <div class="history">
<span>Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )<br></span> <span data-action="type" data-delay="1000" data-strings="^600docker exec -it gitlab-runner gitlab-runner register">$ docker exec -it gitlab-runner gitlab-runner register<br></span>
<span>https://gitlab.yoursite.com<br></span> <span data-strings="^400https://gitlab.yoursite.com" data-prompt="Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )<br>" data-action="prompt" data-delay="1000">Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )<br>https://gitlab.yoursite.com<br></span>
<span>Please enter the gitlab-ci token for this runner<br></span> <span data-action="prompt" data-delay="1000" data-prompt="Please enter the gitlab-ci token for this runner<br>" data-strings="^600f3FeWDf4gsdv-2DefS3Sfg">Please enter the gitlab-ci token for this runner<br></span>
<span>3FeWDf4gsdv-2DefS3Sfg<br></span> <span>3FeWDf4gsdv-2DefS3Sfg<br></span>
<span>Please enter the gitlab-ci description for this runner<br></span> <span data-action="prompt" data-delay="1000" data-prompt="Please enter the gitlab-ci description for this runner<br>" data-strings="^400My-runnerboi">Please enter the gitlab-ci description for this runner<br></span>
<span>My-runnerboi<br></span> <span>My-runnerboi<br></span>
<span>Please enter the gitlab-ci tags for this runner (comma separated):<br></span> <span data-action="prompt" data-delay="1000" data-prompt="Please enter the gitlab-ci tags for this runner (comma separated):<br>" data-strings="hexo,nodejs">Please enter the gitlab-ci tags for this runner (comma separated):<br></span>
<span>hexo,nodejs<br></span> <span>hexo,nodejs<br></span>
<span>Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:<br></span> <span data-action="prompt" data-delay="1000" data-prompt="Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:<br>" data-strings="^300shell">Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:<br></span>
<span>shell<br></span> <span>shell<br></span>
<span data-action="empty"></span> <span data-action="empty"></span>
</div> </div>
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
<h2 id="Setting-up-the-source"><a href="#Setting-up-the-source" class="headerlink" title="Setting up the source"></a>Setting up the source</h2> <h2 id="Setting-up-the-source"><a href="#Setting-up-the-source" class="headerlink" title="Setting up the source"></a>Setting up the source</h2>
<p>Everything is set up! If you’ve followed along this far you’re in the home stretch. All that’s left to do now is to set up your hexo <code>._config.yml</code> file and make a new <code>.gitlab-ci.yml</code> file.</p> <p>Everything is set up! If you’ve followed along this far you’re in the home stretch. All that’s left to do now is to set up your hexo <code>._config.yml</code> file and make a new <code>.gitlab-ci.yml</code> file.</p>
<h3 id="Hexo-config"><a href="#Hexo-config" class="headerlink" title="Hexo config"></a>Hexo config</h3> <h3 id="Hexo-config"><a href="#Hexo-config" class="headerlink" title="Hexo config"></a>Hexo config</h3>
<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 (Obviously changing the repo url to the one you set up). </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 (Obviously changing the repo url to the one you set up).</p>
<figure class="highlight yml"> <figure class="highlight yml">
<table> <table>
<tr> <tr>
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
</table> </table>
</figure> </figure>
<p>This commits via ssh. The server will check the commit against your users public key that we pasted to it in the first step. By default, hexo will commit only the public directory when using this deploy method. Nothing left to set up in hexo <p>This commits via ssh. The server will check the commit against your users public key that we pasted to it in the first step. By default, hexo will commit only the public directory when using this deploy method. Nothing left to set up in hexo
as it will commit exactly what we want </p> as it will commit exactly what we want</p>
<h3 id="CI-config"><a href="#CI-config" class="headerlink" title="CI config"></a>CI config</h3> <h3 id="CI-config"><a href="#CI-config" class="headerlink" title="CI config"></a>CI config</h3>
<p>Time to make a file in your blogsource root folder called <code>._gitlab-ci.yml</code>. Mine looks a little like this.</p> <p>Time to make a file in your blogsource root folder called <code>._gitlab-ci.yml</code>. Mine looks a little like this.</p>
<figure class="highlight yaml"> <figure class="highlight yaml">
...@@ -302,7 +302,7 @@ ...@@ -302,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">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> <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>
...@@ -312,28 +312,51 @@ ...@@ -312,28 +312,51 @@
to do it’s job. In this step we’re:</p> to do it’s job. In this step we’re:</p>
<ul> <ul>
<li>Making sure our runner has ssh-agent which is needed for commits through ssh</li> <li>Making sure our runner has ssh-agent which is needed for commits through ssh</li>
<li>Making our ssh config file and putting our <code>SSH_CONFIG</code> variable into it. </li> <li>Making our ssh config file and putting our <code>SSH_CONFIG</code> variable into it.</li>
<li>Piping our ssh key into the <code>ssh-add</code> application which registers it to our keychain</li> <li>Piping our ssh key into the <code>ssh-add</code> application which registers it to our keychain</li>
<li>Checking if we have <abbr title="Node Version Manager">nvm</abbr> and installing it if we don’t</li> <li>Checking if we have <abbr title="Node Version Manager">nvm</abbr> and installing it if we don’t</li>
<li>Checking for <abbr title="Node Package Manager">npm</abbr> and installing nodejs (which includes npm) if it’s not there</li> <li>Checking for <abbr title="Node Package Manager">npm</abbr> and installing nodejs (which includes npm) if it’s not there</li>
<li>Installing Hexo</li> <li>Installing Hexo</li>
<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="public"><a href="#public" class="headerlink" title="public"></a>public</h4>
<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> <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>
<li>Checking out our most recent build</li> <li>Checking out our most recent build</li>
<li>Generating our blog with the debug setting. (This can be useful for figuring out why things aren’t working with your site.)</li> <li>Generating our blog with the debug setting. (This can be useful for figuring out why things aren’t working with your site.)</li>
<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> <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>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 <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" 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> rel="external nofollow noopener noreferrer" target="_blank">this post on digital ocean</a>.</p>
<h2 id="Back-to-Gitlab-one-final-time-1"><a href="#Back-to-Gitlab-one-final-time-1" class="headerlink" title="Back to Gitlab one final time"></a>Back to Gitlab one final time</h2>
<p><img src="/images/gitlabrunner/vars.png" alt="pipeline variables"></p>
<p>Add to .known_hosts in order to not get “Host key verification failed…” error</p>
<p><code>Host *\n\tStrictHostKeyChecking no\n\nHost gitlab.mysite.com\n\tport 22</code><br>This will parse out to:<br>
<figure class="highlight plain">
<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></pre>
</td>
<td class="code">
<pre><span class="line">Host *</span><br><span class="line"> StrictHostKeyChecking no</span><br><span class="line"></span><br><span class="line">Host gitlab.mysite.com</span><br><span class="line"> port 22</span><br></pre>
</td>
</tr>
</table>
</figure>
</p>
<h2 id="Using-it-1"><a href="#Using-it-1" 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.
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>
<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>
<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. <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>
...@@ -350,6 +373,25 @@ https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deploym ...@@ -350,6 +373,25 @@ https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deploym
https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html
--> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="/js/term.js"></script>
<script type="text/javascript">
var terminals = []
$(document).ready(function() {
$(".terminal-window").each(function(index) {
console.log(index, this);
var ts = {}
ts.target = this
ts.prompt = "$ "
ts.cursor = "&#9610"
var terminal = new Terminal(ts);
terminals.push(terminal);
})
});
</script>
</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>
...@@ -376,7 +418,7 @@ https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html ...@@ -376,7 +418,7 @@ https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html
})(); })();
</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-02T14:16:15.769Z"> <meta itemprop="dateModified" content="2018-11-03T18:11:22.621Z">
<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-02T14:16:15.769Z</lastmod> <lastmod>2018-11-03T18:11:22.621Z</lastmod>
</url> </url>
...@@ -30,28 +30,28 @@ ...@@ -30,28 +30,28 @@
</url> </url>
<url> <url>
<loc>http://blog.thebestjohn.com/posts/matrix-keypad/</loc> <loc>http://blog.thebestjohn.com/posts/static-what-generator/</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/matrix-keypad/</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/static-what-generator/</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>
</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>
......
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