Commit ac9e0da3418363b80bde97c1ccc2638204354ad0
1 parent
6277194c
Add GitLab CI config (.gitlab-ci.yml) for GitLab Pages publish
Showing
3 changed files
with
36 additions
and
3 deletions
.gitignore
.gitlab-ci.yml
0 → 100644
| 1 | +# GitLab Pages: build the MkDocs site and publish to GitLab Pages. | |
| 2 | +# Triggered on every push to the default branch. | |
| 3 | +# | |
| 4 | +# Requirements on the GitLab project: | |
| 5 | +# - GitLab Pages enabled (Settings → Pages). | |
| 6 | +# - The default branch matches the `rules:` clause below (main). | |
| 7 | + | |
| 8 | +image: python:3.11-slim | |
| 9 | + | |
| 10 | +stages: | |
| 11 | + - build | |
| 12 | + | |
| 13 | +pages: | |
| 14 | + stage: build | |
| 15 | + before_script: | |
| 16 | + - pip install --quiet --upgrade pip | |
| 17 | + - pip install --quiet -r requirements.txt | |
| 18 | + script: | |
| 19 | + # GitLab Pages requires the published directory to be named `public/`. | |
| 20 | + - mkdocs build --strict --site-dir public | |
| 21 | + artifacts: | |
| 22 | + paths: | |
| 23 | + - public | |
| 24 | + rules: | |
| 25 | + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH | ... | ... |
README.md
| ... | ... | @@ -43,9 +43,16 @@ git remote add origin <your-remote-url> |
| 43 | 43 | git push -u origin main |
| 44 | 44 | ``` |
| 45 | 45 | |
| 46 | -Once the repo lives at a GitHub URL with Pages enabled (Settings → Pages | |
| 47 | -→ Source: GitHub Actions), the workflow at `.github/workflows/publish.yml` | |
| 48 | -will build and deploy the static site on every push to `main`. | |
| 46 | +CI configs are included for both hosts — push to whichever you use: | |
| 47 | + | |
| 48 | +- **GitLab:** `.gitlab-ci.yml` builds and publishes to GitLab Pages | |
| 49 | + on every push to the default branch. Enable Pages in | |
| 50 | + *Project → Settings → Pages*. | |
| 51 | +- **GitHub:** `.github/workflows/publish.yml` builds and publishes to | |
| 52 | + GitHub Pages. Enable in *Settings → Pages → Source: GitHub Actions*. | |
| 53 | + | |
| 54 | +The unused config can stay — it's harmless and keeps the wiki portable | |
| 55 | +between hosts. | |
| 49 | 56 | |
| 50 | 57 | ## Out-of-scope |
| 51 | 58 | ... | ... |