GitLab Pages Publish Recipe

Montuer has a continuously developed publish recipe dedicated for GitLab Pages, a great platform for web content publications.

The objective is simple: to quickly and steadily setup GitLab Pages publication operations up and ready, and seamlessly easy.

All users has to do is to issue this command:

1
monteur publish

For this recipe, they are arranged based on its own semantic versioning and is not directly related to Monteur's actual release version. Hence, feel free to explore and update each versions to suit your CI needs.

Resources

This recipe is built and maintained based on the following resources:

One-Time Setup

To ensure maximum portability, Monteur recommends the use of gh-pages, a git branch where GitHub is recognizing for its GitHub Pages in GitLab Pages implementations. That way, when there is a need to migrate between GitHub and GitLab in either directions, it should offer a seamless no-technical-steps required migration experiences.

However, doing so requires a ONE-TIME (1) setup with that gh-pages branch. To begin, you simple execute the following git commands on a clean, no staging, and no new editing branch.

1
2
3
4
5
6
$ git checkout --orphan gh-pages
$ git reset --hard
$ git clean -fd
$ git commit --allow-empty -m "Init"
$ git push origin gh-pages:gh-pages
$ git checkout <back to your work branch>

The next step is to ensure your .gitlab-ci.yml CI configuration file has the following task:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
pages:
  stage: docs
  tags:
    - linux
  environment:
    name: production
  only:
    refs:
      - gh-pages
  cache: []
  artifacts:
    paths:
      - public
    expire_in: 1 day
  before_script:
    - mkdir -p public
    - shopt -s extglob
    - mv !(public|.*) public
  script:
    - printf "[ DONE ] Nothing to implement. Proceed to deploy web content.\n"
Once everything are done, you may proceed to recipe procurement as usual.

Recipe File

Here are all the Monteur Publish CI Job recipe files for operating GitLab Pages semi-autonomously. They are sorted by the latest version first, at the top.

Please read through its requiremnets and changes before procuring.

Version v1.0.0

Download Link: gitlab-pages-v1p0p0.toml

Minimum Requirements

  • Montuer version: v0.0.1 and above.

  • Supported platform: STRICTLY depends on git availability.

Installation Instructions

  • Download and place the recipe file into your .configs/monteur/publish/jobs directory as gitlab-pages.toml.

  • Update the recipe's FMTVariables.SourceDir pointing to the directory holding your website artifact (e.g. public/) directory.

  • Update the recipe's Dependencies when needed to match your customization needs.

  • Update the recipe's CMD when needed to match your customization needs.

Changelog

  • BACKWARD COMPATBILE - Created the base TOML configuration recipe.

  • BACKWARD COMPATBILE - Tested with GitLab CI.

  • BACKWARD COMPATBILE - Implemented gh-pages branch method correctly.

  • BACKWARD COMPATBILE - Maintain single artifact commit to remove duplications and reduce git repository size as publication develops.

Epilogue

That's all for Monteur's Publish CI Job handling GitLab Pages web publication system. If you have any question, please feel free to raise your question at our Issues Section.