<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>@ajwrites.today</title><link>https://ajwrites.today/</link><description>Recent content on @ajwrites.today</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Mon, 02 Sep 2024 19:13:38 -0400</lastBuildDate><atom:link href="https://ajwrites.today/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo and Neocities Setup with GitHub Actions</title><link>https://ajwrites.today/posts/hugo-neocities-setup/</link><pubDate>Mon, 02 Sep 2024 19:13:38 -0400</pubDate><guid>https://ajwrites.today/posts/hugo-neocities-setup/</guid><description>Hugo and Neocities Decided to setup a static site with Hugo and deploy it to Neocities using GitHub actions.
Here&amp;rsquo;s how I did it:
Hugo setup NOTE: Follow Quick Start for up to date instructions.
Ubuntu setup sudo snap install hugo Then followed the rest of the steps in Quick Start.
GitHub Workflow Create a .github/workflows directory under your hugo repo if it doesn&amp;rsquo;t already exist.
mkdir -p .github/workflows Then save this under .</description><content>&lt;h1 id="hugo-and-neocities">Hugo and Neocities&lt;/h1>
&lt;p>Decided to setup a static site with Hugo and deploy it to Neocities using GitHub actions.&lt;/p>
&lt;p>Here&amp;rsquo;s how I did it:&lt;/p>
&lt;h2 id="hugo-setup">Hugo setup&lt;/h2>
&lt;p>NOTE: Follow &lt;a href="https://gohugo.io/getting-started/quick-start/">Quick Start&lt;/a> for up to date instructions.&lt;/p>
&lt;h3 id="ubuntu-setup">Ubuntu setup&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>sudo snap install hugo
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then followed the rest of the steps in &lt;a href="https://gohugo.io/getting-started/quick-start/">Quick Start&lt;/a>.&lt;/p>
&lt;h2 id="github-workflow">GitHub Workflow&lt;/h2>
&lt;p>Create a &lt;code>.github/workflows&lt;/code> directory under your hugo repo if it doesn&amp;rsquo;t already exist.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mkdir -p .github/workflows
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then save this under &lt;code>.github/workflows/hugo-neocities.yml&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yml" data-lang="yml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">name&lt;/span>: &lt;span style="color:#ae81ff">Neocities&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">on&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">push&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">branches&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#ae81ff">main &lt;/span> &lt;span style="color:#75715e"># Set a branch to deploy&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">pull_request&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">jobs&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">deploy&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">runs-on&lt;/span>: &lt;span style="color:#ae81ff">ubuntu-22.04&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">concurrency&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">group&lt;/span>: &lt;span style="color:#ae81ff">${{ github.workflow }}-${{ github.ref }}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">steps&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#f92672">uses&lt;/span>: &lt;span style="color:#ae81ff">actions/checkout@v4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">with&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">submodules&lt;/span>: &lt;span style="color:#66d9ef">true&lt;/span> &lt;span style="color:#75715e"># Fetch Hugo themes (true OR recursive)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">fetch-depth&lt;/span>: &lt;span style="color:#ae81ff">0&lt;/span> &lt;span style="color:#75715e"># Fetch all history for .GitInfo and .Lastmod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#f92672">name&lt;/span>: &lt;span style="color:#ae81ff">Setup Hugo&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">uses&lt;/span>: &lt;span style="color:#ae81ff">peaceiris/actions-hugo@v3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">with&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">hugo-version&lt;/span>: &lt;span style="color:#e6db74">&amp;#39;0.119.0&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e"># extended: true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#f92672">name&lt;/span>: &lt;span style="color:#ae81ff">Build&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">run&lt;/span>: &lt;span style="color:#ae81ff">hugo --minify&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#f92672">name&lt;/span>: &lt;span style="color:#ae81ff">Deploy&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">uses&lt;/span>: &lt;span style="color:#ae81ff">bcomnes/deploy-to-neocities@v2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">with&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">api_token&lt;/span>: &lt;span style="color:#ae81ff">${{ secrets.NEOCITIES_API_TOKEN }}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">cleanup&lt;/span>: &lt;span style="color:#66d9ef">false&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">dist_dir&lt;/span>: &lt;span style="color:#ae81ff">public&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Add this to your git repo.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>git add .github/workflows/hugo-neocities.yml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#e6db74">&amp;#34;Add github workflow&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You&amp;rsquo;ll then need to get a Neocities API key by going to your site settings -&amp;gt; API.&lt;/p>
&lt;p>On GitHub, go to your repo&amp;rsquo;s Settings, then under Security go to Secrets and variables -&amp;gt; Actions. Click &amp;ldquo;New repository secret&amp;rdquo;. Set the secret name to &lt;code>NEOCITIES_API_TOKEN&lt;/code> and the value to the Neocities API key.&lt;/p>
&lt;p>From now on, when you add new content and push to your remote GitHub repo, GitHub actions will generate the site and then upload it to Neocities.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>git commit -am &lt;span style="color:#e6db74">&amp;#34;New post&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push -u origin main
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></content></item><item><title>About</title><link>https://ajwrites.today/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ajwrites.today/about/</guid><description>About me I&amp;rsquo;m a software engineer who&amp;rsquo;s not particularly interesting. A pretty run-of-the-mill type who uses Linux, dabbles in electronics, 3D printing, among other tech hobbies.</description><content>&lt;h1 id="about-me">About me&lt;/h1>
&lt;p>I&amp;rsquo;m a software engineer who&amp;rsquo;s not particularly interesting. A pretty run-of-the-mill type who uses Linux, dabbles in electronics, 3D printing, among other tech hobbies.&lt;/p></content></item></channel></rss>