sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

Support Gitlab Pages #24

Closed sc0ttj closed 5 years ago

sc0ttj commented 5 years ago

See: https://about.gitlab.com/2016/04/07/gitlab-pages-setup/

To add support for GitLab Pages, just add a .gitlab-ci.yml file in the root dir:

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - gh-pages

From GitLab:

What this code is doing is creating a job called pages telling the Runner to deploy the website artifacts to a public path, whenever a commit is pushed only to the gh-pages branch.

All pages are created after the build completes successfully and the artifacts for the pages job are uploaded to GitLab.

NOTE: only means "only the branch gh-pages" ... We could use master (the default) but for better GitHub Pages compatiblity we can use gh-pages instead ;)

This should suffice for mdsh

sc0ttj commented 5 years ago

For more complex static site generators (like Hexo), you would use something like this:

To build our Hexo site, we can start with this .gitlab-ci.yml:

image: node:4.2.2

pages:
  cache:
    paths:
    - node_modules/

  script:
  - npm install hexo-cli -g
  - npm install
  - hexo deploy
  artifacts:
    paths:
    - public
  only:
    - master