loading...
Cover image for GithubActions powered  blog and online CV

GithubActions powered blog and online CV

svasylenko profile image Serhii Vasylenko ・2 min read

My contribution to GitHub Actions Hackathon on DEV

This project is built on four powerful technologies:

  • Jekyll - used as a static website generator
  • Pandoc - used as a rendering tool (markdown > html) for CV
  • Github Pages - used as a hosting
  • GithubActions - used for build and deploy automation

My Workflow

There are two workflows: one for the blog (website), and one for the CV (cv).
They both use the following Github Actions:

In both workflows, the build job is performed within a container, which is different per workflow: Ruby for the blog and Pandoc for CV.

Here is how the build job looks like for the blog:

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: ruby:2.6.4
      options: 
        --workdir /src 
    steps:
      - name: Checkout
        uses: actions/checkout@v2 

      - name: Build blog
        run: |
          bundle install
          bundle exec jekyll build --verbose --destination _site

      - name: Upload artifacts
        uses: actions/upload-artifact@v2
        with: 
          name: _site
          path: _site

As you can see, I run the steps within the Ruby container. This simplifies things related to file permissions and directory mounting because checkout is made inside the container.

The deploy step is performed via shell run command for now, for better clearness (can be replaced to third-party action or custom-made one): it makes a commit to gh-pages branch which is configured for Github Pages.

  deploy:
    if: github.ref == 'refs/heads/master'
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout gh-pages branch
        uses: actions/checkout@v2
        with:
          ref: 'gh-pages'

      - name: Get the build artifact
        uses: actions/download-artifact@v2
        with:
          name: _site
          path: ./

      - name: Deploy (push) to gh-pages
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "${GITHUB_ACTOR}@bots.github.com"
          git add -A 
          git commit -a -m "Updated Website"
          git remote set-url origin "https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/vasylenko/serhii.vasylenko.info.git"
          git push --force-with-lease origin gh-pages

Submission Category:

DIY Deployments

Yaml File or Link to Code

Here is a link to repository with workflows (see /.github/workflows directory)

GitHub logo vasylenko / serhii.vasylenko.info

A source code of my personal website powered by Jekyll

Personal blog powered by Jekyll

Slightly modified Jekyll theme (see source links below) with automatic build and deployment to Github Pages.

Build and deploy are automated by Github Actions – .github/workflows/website.yaml.

Deploy goes to gh-pages branch which is confiogured for Github Pages.

Markdown CV with rendering to HTML

Base directory – cv.

"source code" for the CV is a Markdown file which is rendered by pandoc utility. Font, layout and other customizations are made in .css file, as ususally. There are no customizations to renderigng.

Build and deploy are automated by Github Actions – .github/workflows/cv.yaml.

Deploy goes to the same gh-pages branch.

Technologies used:

Additional Resources / Info

https://jekyllrb.com
https://pandoc.org

Discussion

pic
Editor guide