1 min read

Build your own free website

Build your own free website

If you want to build your own site like this, all you need is the pipeline and the following docker command:

docker run --name ghost --rm -p 2368:2368 -e NODE_ENV=development -e database__connection__filename='/var/lib/ghost/content/data/ghost.db' -v $PWD/content:/var/lib/ghost/content ghost:alpine 

This will start a local instance of ghost to generate the database itself. Once the code is commited to your repo, it will automatically build your GitHub sit based on your username. Github pages reserve {username}.github.io repo names and build sites automatically for you. My public .github repo has an automated build repo and the push to your github.io repo. The following code will invoke the public pipeline using your username:

name: Build Repo and Ghost

on:
  workflow_dispatch:
    branches:
      - main
  push:
    branches:
      - main

jobs:
  deploy:
    # uses: ./.github/workflows/build-and-deploy.yaml
    uses: xander-rudolph/.github/.github/workflows/build-and-deploy.yaml@master
    with:
      github-user: ${{ github.actor }}
    secrets: inherit

When code is pushed to main, the docker image will build out the static content and publish the site.

The pipeline will automatically create your user GitHub repo which should be set to PUBLIC so the github page can be viewed without authentication (GitHub Authentication that is). The repo you are using to drive the publishing of this website should be PRIVATE to ensure that the content (namely the sqlite db) is secure in your repo.