Intro
CI/CD Fundamentals
.gitlab-ci.yml Basics
GitLab Runners
GitLab Executors
Specific Runners
Artifacts
Documentation Generation
Monitoring
Documentation Generation in GitLab CI/CD Pipelines
This module will cover how to use MkDocs to generate and deploy documentation for your project. MkDocs is a powerful tool for creating static sites from Markdown files and integrates seamlessly with GitLab Pages. By the end of this module, you’ll be able to set up MkDocs, write documentation, and deploy it through GitLab CI/CD.
Objectives
Understand MkDocs and its configuration.
- Set up a MkDocs project.
- Write and structure documentation using Markdown.
- Build and preview documentation locally.
- Configure GitLab CI/CD to deploy documentation to GitLab Pages.
1. Introduction to MkDocs
MkDocs is a static site generator that uses Markdown for content creation and YAML for configuration. It provides an easy-to-use interface for generating project documentation.
Key Features:
- Markdown Support: Write documentation in Markdown.
- Customizable Themes: Choose from built-in themes or customize your own.
- GitLab Pages Integration: Easily deploy documentation to GitLab Pages.
Practical Exercise
-
Install MkDocs:
- Install MkDocs locally on your machine. You can do this using pip:
pip install mkdocs
- Install MkDocs locally on your machine. You can do this using pip:
-
Create a New MkDocs Project:
- Run the following command in your terminal to create a new MkDocs project:
mkdocs new my-project-docs cd my-project-docs
- Run the following command in your terminal to create a new MkDocs project:
-
Structure Your Documentation:
- Explore the generated project structure. Locate the
mkdocs.yml
configuration file and thedocs/
directory.
- Explore the generated project structure. Locate the
-
Run the Development Server:
- Start the MkDocs development server to preview your documentation:
mkdocs serve
- Open your browser and navigate to
http://127.0.0.1:8000
to see the default documentation.
- Start the MkDocs development server to preview your documentation: