<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>GithubActions | Jacob Aloysious</title><link>https://jacobaloysious.in/category/githubactions/</link><atom:link href="https://jacobaloysious.in/category/githubactions/index.xml" rel="self" type="application/rss+xml"/><description>GithubActions</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Wed, 20 May 2020 00:00:00 +0000</lastBuildDate><image><url>https://jacobaloysious.in/images/icon_hu4591c05f594249c11c1e99a3a8f1f246_3759739_512x512_fill_lanczos_center_2.png</url><title>GithubActions</title><link>https://jacobaloysious.in/category/githubactions/</link></image><item><title>Tech - My Website</title><link>https://jacobaloysious.in/post/tech_my-website/</link><pubDate>Wed, 20 May 2020 00:00:00 +0000</pubDate><guid>https://jacobaloysious.in/post/tech_my-website/</guid><description>&lt;p>I registered my domain name on
&lt;a href="https://in.godaddy.com/" target="_blank" rel="noopener">GoDaddy&lt;/a> couple of years back (2018). I can&amp;rsquo;t really remember the motivation to get one registered.
I almost forgot about this, until I got a reminder to renew.&lt;/p>
&lt;p>Thanks to
&lt;a href="https://www.hanselman.com/" target="_blank" rel="noopener">Scott&lt;/a>, I realized the importance of key stroke - the nubmer of keystroke in your life time are finite. So if you worked on something interesting - why waste it in an email which you are never sure the recipient may or not read. Instead, write it in a blog and it would be there forever and could potentially help someone new in future.&lt;/p>
&lt;p>On hindsight - this website should have ideally taken less than half a day to setup, but I ended up spending almost 2 days to set the first version. Well I was just getting my hands dirty.&lt;/p>
&lt;p>This is a static website:&lt;/p>
&lt;ol>
&lt;li>Original Content on
&lt;a href="https://github.com/jacobaloysious/" target="_blank" rel="noopener">GitHub&lt;/a> - my private repo&lt;/li>
&lt;li>Static files Generated using
&lt;a href="https://gohugo.io/" target="_blank" rel="noopener">HUGO Extended&lt;/a>&lt;/li>
&lt;li>Themes from
&lt;a href="https://themes.gohugo.io/academia-hugo/" target="_blank" rel="noopener">Academia&lt;/a>&lt;/li>
&lt;li>Static files Hosted on
&lt;a href="https://aws.amazon.com/s3" target="_blank" rel="noopener">AWS S3&lt;/a>&lt;/li>
&lt;li>Domain DNS
&lt;a href="https://aws.amazon.com/route53/" target="_blank" rel="noopener">AWS Route S3&lt;/a>&lt;/li>
&lt;li>Continous Deployment
&lt;a href="https://github.com/features/actions" target="_blank" rel="noopener">Github Actions&lt;/a>&lt;/li>
&lt;/ol>
&lt;h3 id="godaddy">Godaddy&lt;/h3>
&lt;p>This is a very trivial step, go to
&lt;a href="https://in.godaddy.com/" target="_blank" rel="noopener">GoDaddy&lt;/a>. Search if your expected domain name is available. If yes, just follow the steps that show up.
Note: There are many providers GoDaddy is just one of them. I dont have a good reason why I chose GoDaddy or I haven&amp;rsquo;t seen a good reason to try other providers (read, lazy me).&lt;/p>
&lt;h3 id="hugo">Hugo&lt;/h3>
&lt;p>Hugo again has extensive documentation (bit overwhelming at times) on setting up.
Every theme you donwload come with an
&lt;a href="https://github.com/gcushen/hugo-academic/tree/master/exampleSite" target="_blank" rel="noopener">example site&lt;/a>, all you need to do is just start deleting content.&lt;/p>
&lt;p>One item I really like is the &lt;strong>live reload&lt;/strong> - when &lt;strong>hugo server&lt;/strong> is running (locally) - the website would be auto deployed and page reloaded with new content as and when you save your file.&lt;/p>
&lt;p>&lt;strong>Tip:&lt;/strong> Theme I downloaded was using Hugo &lt;strong>Extended&lt;/strong> and not the default one. It took me almost half a day to figure this out :-( debugging through css generation failures etc..&lt;/p>
&lt;h3 id="aws-configuration">AWS Configuration&lt;/h3>
&lt;p>This article walks you through pretty much all the steps. If you are getting started, recomend to skip the cloundfront part:
&lt;a href="https://medium.com/faun/how-to-host-your-static-website-with-s3-cloudfront-and-set-up-an-ssl-certificate-9ee48cd701f9" target="_blank" rel="noopener">how-to-host-your-static-website-with-s3&lt;/a>&lt;/p>
&lt;h3 id="continous-deploy-actions">Continous Deploy (Actions)&lt;/h3>
&lt;p>This was my favourite part, I am personally a CI/CD enthusiast. I wanted to deploy my website every time I push changes into my GitRepo.&lt;/p>
&lt;p>I used
&lt;a href="https://github.com/marketplace/actions/s3-sync" target="_blank" rel="noopener">S3 Sync Actions&lt;/a> from marketplace. It has a few additional steps like generting &lt;em>AWS_ACCESS_KEY_ID&lt;/em> and &lt;em>AWS_SECRET_ACCESS_KEY&lt;/em> to get it configured.&lt;/p>
&lt;p>&lt;strong>Important: Secure you keys, by setting it up as secure env variable in github - so that it doesn&amp;rsquo;t show up in console log&lt;/strong>&lt;/p>
&lt;p>Use my icon for the website:
Every theme comes with its own default icon. Since I have referenced the theme as a GIT Submodule - as part of CD/workflow build is was always overwritten.
Did a minor hack - I checked in my icon into my repo and as part of build replaced the default theme icons with mine before build step.&lt;/p>
&lt;p>Below is the GitHub Action I stitched together.&lt;/p>
&lt;pre>&lt;code> name: CD
on:
push:
branches:
- master
jobs:
deploy:
name: deploy-website
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout master
uses: actions/checkout@master
- name: Update theme
run: git submodule update --init --recursive
- name: Setup hugo #https://github.com/peaceiris/actions-hugo
uses: peaceiris/actions-hugo@v2
with:
extended: true #This website is based on Hugo-Extended
hugo-version: &amp;quot;0.70.0&amp;quot; #We could also use latest
- name: copy my icon
run: cp -f ./assets/images/icon.png ./themes/academic/assets/images/icon.png
- name: Build Website
run: hugo --minify
- name: Publish To AWS S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --exclude '.git/*'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'ap-south-1' # optional: defaults to us-east-1
SOURCE_DIR: 'public' # Req: hugo gen - static files into this dir
&lt;/code>&lt;/pre></description></item></channel></rss>