Pipeline for blog
Historically I’m mostly using visualstudio.com as a repo for my personal stuff. There was few reasons for this:
- Long time ago github.com allowed to host sources for free, but only in public repos… I’m not so brave to make my personal shity-style code public available thus I wanted to have private repositories. visualstudio.com allowed to store unlimited number of private repos.
- visualstudio.com had pipelines long before it become available on github.com and on many other code hosting service.
- I was a big fan of Microsoft… yep… I know, I know. Shame on me.
So now I’m going to use same thing for storing my source, but for website hosing I’ll use pages.github.com as one of the most simple and still free static site hosting services.
The general approach is trivial:
- Setup empty repo on github.com and configure it to be hosted by pages.github.com
- Have a repo on visualstudio.com with sources
- Setup Azure pipeline to build website and push it to github.com repo
To make #3 possible it will be required to generate deployment key with write permissions. Public key will be on github.com while private in visualstudio.com
I ended up with following pipeline definition:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseRubyVersion@0
inputs:
versionSpec: '>= 3.0.0'
- task: DownloadSecureFile@1
inputs:
secureFile: private
- script: |
bundle install
jekyll build
cd .site
echo "eiva.dev" > CNAME
git init
git config --local user.name "Azure Pipelines"
git config --local user.email "azure@eiva.dev"
git add .
git commit -m "Publishing GitHub Pages"
mkdir ~/.ssh && mv $DOWNLOADSECUREFILE_SECUREFILEPATH ~/.ssh/id_rsa
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote add origin git@github.com:eiva/eiva.github.io.git
git push -f origin HEAD:master
And now - whenever I updating my repo - all changes automatically got published as my blog.
Not harder than get to any web ui and type it.
The benefit of such thing - that it handle any “updates” or “edits” perfectly.
Next followup - to find good theme, as this minaml
is good but I prefer to have dark theme.