<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>github on Andrew Beaton</title>
    <link>https://andrewbeaton.net/tags/github/</link>
    <description>Recent content in github on Andrew Beaton</description>
    <image>
      <title>Andrew Beaton</title>
      <url>https://andrewbeaton.net/me.jpeg</url>
      <link>https://andrewbeaton.net/me.jpeg</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 09 Jun 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://andrewbeaton.net/tags/github/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Create and Publish a Docker Image to GitHub&#39;s Container Registry using GitHub Actions.</title>
      <link>https://andrewbeaton.net/posts/2023/06/docker-github-registry-actions/</link>
      <pubDate>Fri, 09 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://andrewbeaton.net/posts/2023/06/docker-github-registry-actions/</guid>
      <description>A guide on how to publish a Docker image to GitHub&amp;#39;s Container Registry using GitHub Actions.</description>
      <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>In this tutorial, I will walk you through the process of publishing a Docker image to GitHub&rsquo;s Container Registry using GitHub Actions. By using GitHub Actions, you can automate the build and publish process, making it easier to distribute your Docker images.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Before getting started, make sure you have the following:</p>
<ol>
<li>A GitHub account.</li>
<li>A Dockerfile that describes your application&rsquo;s dependencies and build instructions.</li>
<li>A GitHub repository where you want to publish your Docker image.</li>
</ol>
<h2 id="step-1-set-up-github-actions-workflow">Step 1: Set up GitHub Actions workflow</h2>
<p>GitHub Actions allow you to automate tasks by creating workflows.</p>
<p>To publish a Docker image, we&rsquo;ll create a workflow file named <code>publish.yml</code>.</p>
<p>Create a new directory called <code>.github/workflows</code> in the root of your repository, if it doesn&rsquo;t already exist.</p>
<p>Inside this directory, create a new file named <code>publish.yml</code> and add the following content:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">name</span>: <span style="color:#ae81ff">Publish Docker Image</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">on</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">push</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">branches</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">main</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">jobs</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">build-and-publish</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">runs-on</span>: <span style="color:#ae81ff">ubuntu-latest</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">steps</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Checkout code</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">uses</span>: <span style="color:#ae81ff">actions/checkout@v2</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Login to GitHub Container Registry</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">uses</span>: <span style="color:#ae81ff">docker/login-action@v1</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">with</span>:
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">registry</span>: <span style="color:#ae81ff">ghcr.io</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">username</span>: <span style="color:#ae81ff">${{ github.actor }}</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">password</span>: <span style="color:#ae81ff">${{ secrets.GITHUB_TOKEN }}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Build and push Docker image</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">uses</span>: <span style="color:#ae81ff">docker/build-push-action@v2</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">with</span>:
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">context</span>: <span style="color:#ae81ff">.</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">push</span>: <span style="color:#66d9ef">true</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">tags</span>: <span style="color:#ae81ff">ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.sha }}</span>
</span></span></code></pre></div><p>This workflow will trigger whenever you push changes to the <code>main</code> branch. It checks out the code, logs in to GitHub&rsquo;s Container Registry using your GitHub credentials, and builds and pushes the Docker image to the registry.</p>
<h2 id="step-2-configure-the-dockerfile">Step 2: Configure the Dockerfile</h2>
<p>In your repository, create a file named <code>Dockerfile</code> and add the necessary instructions to build your Docker image. Here&rsquo;s an example <code>Dockerfile</code> for a Node.js application:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-Dockerfile" data-lang="Dockerfile"><span style="display:flex;"><span><span style="color:#66d9ef">FROM</span><span style="color:#e6db74"> node:14</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">WORKDIR</span><span style="color:#e6db74"> /app</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">COPY</span> package.json package-lock.json ./<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">RUN</span> npm ci --only<span style="color:#f92672">=</span>production<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">COPY</span> app.js .<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">CMD</span> [<span style="color:#e6db74">&#34;node&#34;</span>, <span style="color:#e6db74">&#34;app.js&#34;</span>]<span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p>Make sure to modify the <code>Dockerfile</code> to suit your application&rsquo;s requirements.</p>
<h2 id="step-3-push-changes-to-your-repository">Step 3: Push changes to your repository</h2>
<p>Commit and push the <code>Dockerfile</code>, <code>publish.yml</code>, and any other files you may have modified to your repository.</p>
<h2 id="step-4-monitor-the-workflow-execution">Step 4: Monitor the workflow execution</h2>
<p>After pushing the changes, navigate to the &ldquo;Actions&rdquo; tab in your GitHub repository. You should see the workflow you created (&ldquo;Publish Docker Image&rdquo;) listed there. Click on it to monitor the execution.</p>
<h2 id="step-5-verify-the-docker-image-in-github-container-registry">Step 5: Verify the Docker image in GitHub Container Registry</h2>
<p>Once the workflow execution is complete, go to the &ldquo;Packages&rdquo; tab in your GitHub repository. You should see your Docker image listed there. Click on it to view the details.</p>
<h2 id="summary">Summary</h2>
<p>You have successfully published a Docker image to GitHub&rsquo;s Container Registry using GitHub Actions. By automating this process, you can easily distribute your Docker images and ensure consistent deployment across different environments. GitHub Actions provides a powerful platform for automating various tasks in your development workflow, saving you time and effort.</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Create and Publish a Docker Image to GitHub&#39;s Container Registry</title>
      <link>https://andrewbeaton.net/posts/2023/06/docker-github-container-registry/</link>
      <pubDate>Thu, 08 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://andrewbeaton.net/posts/2023/06/docker-github-container-registry/</guid>
      <description>A guide on how to publish a Docker image to GitHub&amp;#39;s Container Registry using Docker Push.</description>
      <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>Docker has become an essential tool in modern software development, enabling easy and efficient containerisation of applications. GitHub&rsquo;s Container Registry provides a convenient way to store and manage Docker images within the GitHub ecosystem.</p>
<p>In this tutorial, we will walk through the process of creating, editing, and publishing a Docker image to GitHub&rsquo;s Container Registry.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Before we begin, ensure that you have the following:</p>
<ol>
<li>A GitHub account</li>
<li>Docker installed on your local machine</li>
<li>Basic familiarity with Docker commands</li>
</ol>
<h2 id="step-1-create-a-dockerfile">Step 1: Create a Dockerfile</h2>
<p>The first step is to create a Dockerfile, which defines the instructions to build your Docker image. Open a text editor and create a new file called <code>Dockerfile</code>. Here&rsquo;s a basic example:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-Dockerfile" data-lang="Dockerfile"><span style="display:flex;"><span><span style="color:#75715e"># Use a base image</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">FROM</span><span style="color:#e6db74"> ubuntu:latest</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#75715e"># Set the working directory</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">WORKDIR</span><span style="color:#e6db74"> /app</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#75715e"># Copy files to the container</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">COPY</span> . /app<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#75715e"># Install dependencies</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">RUN</span> apt-get update <span style="color:#f92672">&amp;&amp;</span> apt-get install -y &lt;your-package-name&gt;<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#75715e"># Specify the command to run when the container starts</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">CMD</span> [<span style="color:#e6db74">&#34;&lt;your-command&gt;&#34;</span>]<span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p>Customise the <code>FROM</code> line with the base image you want to use and replace <code>&lt;your-package-name&gt;</code> with the required packages for your application. Also, update <code>&lt;your-command&gt;</code> with the command to start your application.</p>
<h2 id="step-2-build-the-docker-image">Step 2: Build the Docker Image</h2>
<p>Once you have the Dockerfile ready, you can build the Docker image.</p>
<p>Open a terminal or command prompt and navigate to the directory containing the Dockerfile.</p>
<p>Run the following command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker build -t &lt;image-name&gt; .
</span></span></code></pre></div><p>Replace <code>&lt;image-name&gt;</code> with the desired name for your Docker image.</p>
<p>The <code>.</code> at the end specifies the build context, which includes the files needed for building the image.</p>
<p>Wait for the build process to complete.</p>
<p>Docker will execute the instructions in the Dockerfile and generate the image.</p>
<h2 id="step-3-tag-the-docker-image">Step 3: Tag the Docker Image</h2>
<p>To publish the Docker image to GitHub&rsquo;s Container Registry, you need to tag it accordingly.</p>
<p>Run the following command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker tag &lt;image-name&gt; ghcr.io/&lt;username&gt;/&lt;repository&gt;:&lt;tag&gt;
</span></span></code></pre></div><p>Replace <code>&lt;username&gt;</code> with your GitHub username, <code>&lt;repository&gt;</code> with the name of the repository you want to push the image to, and <code>&lt;tag&gt;</code> with the desired tag (e.g., version number or <code>latest</code>).</p>
<h2 id="step-4-log-in-to-github-container-registry">Step 4: Log in to GitHub Container Registry</h2>
<p>Before you can publish the image, you need to authenticate with GitHub&rsquo;s Container Registry.</p>
<p>Run the following command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker login ghcr.io -u &lt;username&gt;
</span></span></code></pre></div><p>Replace <code>&lt;username&gt;</code> with your GitHub username. You will be prompted to enter your GitHub password or a personal access token.</p>
<h2 id="step-5-publish-the-docker-image">Step 5: Publish the Docker Image</h2>
<p>Now that you&rsquo;re logged in, you can publish the Docker image to GitHub&rsquo;s Container Registry.</p>
<p>Run the following command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker push ghcr.io/&lt;username&gt;/&lt;repository&gt;:&lt;tag&gt;
</span></span></code></pre></div><p>Replace <code>&lt;username&gt;</code>, <code>&lt;repository&gt;</code>, and <code>&lt;tag&gt;</code> with the values you used in Step 3.</p>
<p>Wait for the push process to complete. Once finished, your Docker image will be available in GitHub&rsquo;s Container Registry, associated with your specified repository.</p>
<h2 id="step-6-update-and-re-publish">Step 6: Update and Re-Publish</h2>
<p>If you make changes to your Docker image or need to update it with a new version, follow the steps again from Step 2 onwards.</p>
<p>Remember to tag the image with a new version number or an appropriate tag, and push it to GitHub&rsquo;s Container Registry.</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Set up Hugo with Drone and GitHub</title>
      <link>https://andrewbeaton.net/posts/2023/05/hugo-drone-io-github/</link>
      <pubDate>Sat, 20 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://andrewbeaton.net/posts/2023/05/hugo-drone-io-github/</guid>
      <description>Set up Hugo with Drone and GitHub</description>
      <content:encoded><![CDATA[<p>If you&rsquo;re looking for an efficient way to automate your Hugo website deployment, using a Docker Drone.io container as your continuous integration and delivery (CI/CD) platform can be a great choice.</p>
<p>In this guide, I&rsquo;ll walk you through the process of setting up Hugo with a Docker Drone.io container and GitHub, allowing you to streamline your website deployment workflow.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Before getting started, make sure you have the following prerequisites in place:</p>
<ul>
<li><em><strong>Docker installed:</strong></em>
<ul>
<li>Ensure you have Docker installed on your local machine.</li>
</ul>
</li>
<li><em><strong>Basic knowledge of Docker:</strong></em>
<ul>
<li>Familiarity with Docker and Docker Compose will be helpful.</li>
</ul>
</li>
<li><em><strong>A working Hugo website:</strong></em>
<ul>
<li>Set up a Hugo website locally.</li>
</ul>
</li>
<li><em><strong>A GitHub repository:</strong></em>
<ul>
<li>Host your Hugo website&rsquo;s code in a GitHub repository.</li>
</ul>
</li>
</ul>
<h2 id="step-1-set-up-a-docker-droneio-container">Step 1: Set Up a Docker Drone.io Container</h2>
<ol>
<li>Create a new directory on your machine for the Docker Drone.io container configuration.</li>
<li>Create a <code>docker-compose.yml</code> file within that directory and add the following content:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">version</span>: <span style="color:#e6db74">&#39;3&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">services</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">drone-server</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">drone/drone:latest</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">ports</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#e6db74">&#34;8080:80&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">volumes</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">./drone-data:/data</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">restart</span>: <span style="color:#ae81ff">always</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">environment</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">DRONE_GITHUB_CLIENT_ID=your-github-client-id</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">DRONE_GITHUB_CLIENT_SECRET=your-github-client-secret</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">drone-runner</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">drone/drone-runner-docker:latest</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">volumes</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">/var/run/docker.sock:/var/run/docker.sock</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">restart</span>: <span style="color:#ae81ff">always</span>
</span></span></code></pre></div><ol start="3">
<li>
<p>Save the file and navigate to the Docker Drone.io container configuration directory in your terminal.</p>
</li>
<li>
<p>Replace <code>your-github-client-id</code> and <code>your-github-client-secret</code> with the appropriate values. These can be obtained by registering a new OAuth application within GitHub&rsquo;s settings.</p>
</li>
<li>
<p>Run the command <code>docker-compose up -d</code> to start the Docker Drone.io container.</p>
</li>
</ol>
<p>Drone.io should now be accessible at <a href="http://localhost:8080">http://localhost:8080</a>.</p>
<h2 id="step-2-connect-droneio-to-github">Step 2: Connect Drone.io to GitHub</h2>
<ol>
<li>Open Drone.io in your web browser at <a href="http://localhost:8080">http://localhost:8080</a>.</li>
<li>Sign in with your GitHub credentials.</li>
<li>Authorise Drone.io to access your GitHub repositories.</li>
</ol>
<h2 id="step-3-configure-the-droneio-pipeline">Step 3: Configure the Drone.io Pipeline</h2>
<ol>
<li>Within your Hugo website&rsquo;s GitHub repository, create a <code>.drone.yml</code> file in the root directory.</li>
<li>Add the following code to the <code>.drone.yml</code> file:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">kind</span>: <span style="color:#ae81ff">pipeline</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">name</span>: <span style="color:#ae81ff">your-pipeline-name</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">steps</span>:
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Clone Git Submodules</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">alpine/git</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">commands</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">git submodule init</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">git submodule update --recursive --remote</span>
</span></span><span style="display:flex;"><span>      
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Build with Hugo</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">binaryronin/drone-hugo:latest</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">pull</span>: <span style="color:#ae81ff">always</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">commands</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">echo &#34;Checking Hugo version.&#34;</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">hugo version</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">cd /drone/src/hugo/</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">hugo --verbose </span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">ls -al /drone/src/hugo/public </span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Deploy</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">appleboy/drone-scp</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">settings</span>:
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">host</span>: <span style="color:#ae81ff">your-remote-host</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">username</span>: <span style="color:#ae81ff">your-remote-username</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">password</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">from_secret</span>: <span style="color:#ae81ff">your-remote-password-secret</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">source</span>: 
</span></span><span style="display:flex;"><span>        - <span style="color:#ae81ff">/hugo/public/</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">target</span>: <span style="color:#ae81ff">/path/to/your/remote/directory</span>
</span></span></code></pre></div><p>Replace <code>your-pipeline-name</code> with a suitable name for your pipeline.</p>
<ol start="3">
<li>
<p>Adjust the <code>host</code>, <code>username</code>, <code>password</code>, and <code>target</code> fields to match your remote server details and deployment directory.</p>
</li>
<li>
<p>Add a secret for your remote server&rsquo;s password by going to your Drone.io repository settings and adding a secret with the key <code>your-remote-password-secret</code> and the corresponding value.</p>
</li>
</ol>
<h2 id="step-4-trigger-the-pipeline">Step 4: Trigger the Pipeline</h2>
<ol>
<li>Push your updated <code>.drone.yml</code> file to your GitHub repository.</li>
<li>This will trigger the Drone.io pipeline to run.</li>
<li>Monitor the build process in the Drone.io interface to ensure everything is working correctly.</li>
<li>Once the pipeline completes successfully, your Hugo website will be deployed to the specified remote server.</li>
</ol>
<p>You have successfully set up Hugo with a Docker Drone.io container and GitHub. Now, whenever you push changes to your GitHub repository, Drone.io will automatically build your Hugo website and deploy it to your remote server.</p>
<p>I&rsquo;ll continue documenting my journey with Gitea, Drone and Hugo and share the interesting things I find along the way.</p>
<p>If you want to look further in to any of the above tools, do take a look at my previous posts and read the official documentation from the following sites:</p>
<p><a href="https://gitea.io/en-us/">Gitea</a>
<a href="https://www.drone.io/">Drone</a>
<a href="https://gohugo.io/">Hugo</a></p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
