By integrating Github webhooks and CircleCI, your website can be deploy automatically after finishing writing.

Once auto deploy is set correctly, the only thing you need to do to add a new post is to open a browser and write an issue.

How it works

The schematic. And there is a demo repository

ci

How to do

Brief steps

Again, the entire setup steps does not require a local environment

Detail procedures

CircleCI Token

Login CircleCI via GitHub, get CircleCI token, named ci-token

Please note that CircleCI will get all permissions of your projects, including private projects

GitHub Tokens

Login GitHub, goto access token page, create two tokens:

GitHub repository

There should be two branches in the repository

master branch

CircleCI and AcyOrt config files will be put in this branch. The folders structure:

.
├─ .circleci
├  └─ config.yml
└─ config.yml
# .circleci/config.yml
version: 2
jobs:
  build:
    docker:
      - image: node:latest

    working_directory: ~/acyort

    branches:
      only:
        - master # config branch

    steps:
      - checkout
      - run: npm install acyort -g
      - run: acyort init 
      - run: cp config.bak.yml config.yml 
      - run: npm i # optional, if have plugins
      - run: acyort build  
      - run: git checkout .  
      - run: git checkout gh-pages # static files branch
      - run: git reset --hard origin/gh-pages
      - run: cp -R public/* . 
      - run: rm config.bak.yml 
      - run: rm -R scripts themes public 
      - run: git add .
      - run: git config user.name "username" # your GitHub username
      - run: git config user.email "email" # your GitHub email
      - run: git commit -m "Updated by circleci - `date`"
      # fill your usename, repository below 
      - run: git push -q https://${gh_token}@github.com/username/repository.git gh-pages:gh-pages 

You can set git commit timezone

run: git commit -m "Updated by CircleCI - `TZ='Asia/Shanghai' date`"

# config.yml
# only show important fields

user:  # set your GitHub username
repository:  # set your GitHub repository

public_dir: public # important, same as CircleCi config: public
timezone:  # set your timezone
token:  # your `read-token` from github 

gh-pages branch

it must exist. generated static files will be put in this branch.

CNAME file should be put here if there is one.

.gitignore file should be set here

Thumbs.db
.DS_Store
_issues.json
node_modules/
public/

CircleCI settings

Login CircleCI, click PROJECTS, add the repo above, select platform Linux & Node, click Start building. (It will fail because of missing token)

Repository settings

Login GiHub, goto repository settings page, add webhooks

Set Payload URL

CircleCI build trigger API is /project/:vas-type/:username/:project/tree/:branch. so, webhook URL will be something like https://circleci.com/api/v1.1/project/github/username/repository/tree/master?circle-token=ci-token

Select Content type

Use application/json

Select Trigger events

On Let me select individual events, only check the Issues field

Finally

Enjoy writing on Github issues.