|
1 | | -# GitLab CI Configuration for Rucio Website |
| 1 | +# GitLab CI configuration for combined Rucio website + documentation deployment |
| 2 | +# ============================================================================== |
| 3 | +# Builds and deploys both the Rucio website and its documentation to GitLab Pages. |
| 4 | +# |
| 5 | +# How it works: |
| 6 | +# 1. build_site — Copies the static website assets (HTML, images, etc.) into site-build/ |
| 7 | +# 2. fetch_docs — Clones the pre-built documentation from the rucio/documentation |
| 8 | +# gh-pages branch into docs-build/ |
| 9 | +# 3. assemble_public — Merges both artifacts: website at the root of public/, |
| 10 | +# documentation nested under public/documentation/ |
| 11 | +# 4. pages — GitLab Pages picks up the public/ directory and publishes the site |
| 12 | +# |
| 13 | +# A scheduled pipeline (cron job) runs daily to ensure the documentation stays |
| 14 | +# in sync with the latest content published to the rucio/documentation gh-pages branch, |
| 15 | +# even when no new commits are pushed to this repository. |
| 16 | +# |
2 | 17 |
|
3 | | -image: alpine:latest |
| 18 | +stages: |
| 19 | + - build |
| 20 | + - assemble |
| 21 | + - deploy |
| 22 | + |
| 23 | +default: |
| 24 | + image: alpine:latest |
| 25 | + |
| 26 | +variables: |
| 27 | + DOCS_REPO_URL: "https://github.com/rucio/documentation.git" |
| 28 | + DOCS_BRANCH: "gh-pages" |
| 29 | + |
| 30 | +build_site: |
| 31 | + stage: build |
| 32 | + script: |
| 33 | + - mkdir -p site-build |
| 34 | + - cp -r assets site-build/ |
| 35 | + - cp -r images site-build/ |
| 36 | + - cp *.html site-build/ |
| 37 | + artifacts: |
| 38 | + paths: |
| 39 | + - site-build/ |
| 40 | + expire_in: 1 day |
| 41 | + rules: |
| 42 | + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH |
| 43 | + |
| 44 | +fetch_docs: |
| 45 | + stage: build |
| 46 | + script: |
| 47 | + - apk add --no-cache git |
| 48 | + - git clone --depth 1 --branch "$DOCS_BRANCH" "$DOCS_REPO_URL" docs-src |
| 49 | + - mkdir -p docs-build |
| 50 | + # Copy all static docs content except git metadata |
| 51 | + - cp -r docs-src/* docs-build/ || true |
| 52 | + - rm -rf docs-build/.git docs-build/.gitlab-ci.yml |
| 53 | + artifacts: |
| 54 | + paths: |
| 55 | + - docs-build/ |
| 56 | + expire_in: 1 day |
| 57 | + rules: |
| 58 | + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH |
| 59 | + |
| 60 | +assemble_public: |
| 61 | + stage: assemble |
| 62 | + needs: |
| 63 | + - job: build_site |
| 64 | + artifacts: true |
| 65 | + - job: fetch_docs |
| 66 | + artifacts: true |
| 67 | + script: |
| 68 | + - mkdir -p public |
| 69 | + - cp -r site-build/* public/ |
| 70 | + - mkdir -p public/documentation |
| 71 | + - cp -r docs-build/* public/documentation/ |
| 72 | + artifacts: |
| 73 | + paths: |
| 74 | + - public/ |
| 75 | + expire_in: 1 day |
| 76 | + rules: |
| 77 | + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH |
4 | 78 |
|
5 | 79 | pages: |
6 | 80 | stage: deploy |
| 81 | + needs: |
| 82 | + - job: assemble_public |
| 83 | + artifacts: true |
7 | 84 | script: |
8 | | - - mkdir public |
9 | | - - cp -r assets public/ |
10 | | - - cp -r images public/ |
11 | | - - cp *.html public/ |
12 | | - |
| 85 | + - echo "Publishing Rucio Website and Documentation" |
13 | 86 | artifacts: |
14 | 87 | paths: |
15 | 88 | - public |
|
0 commit comments