|
1 | | -version: 2.1 |
2 | | - |
3 | | -workflows: |
4 | | - version: 2 |
5 | | - docs-build: |
6 | | - jobs: |
7 | | - - docs-build |
8 | | - - docs-build-deploy: |
9 | | - requires: |
10 | | - - docs-build |
11 | | - |
12 | | -jobs: |
13 | | - docs-build: |
14 | | - docker: |
15 | | - - image: cimg/python:3.13 |
16 | | - |
17 | | - steps: |
18 | | - - checkout |
19 | | - |
20 | | - - restore_cache: |
21 | | - keys: |
22 | | - - v2-dependencies-python3.13-{{ checksum "setup.py" }}-{{ checksum "requirements-dev.txt" }} |
23 | | - # fallback to using the latest cache if no exact match is found |
24 | | - - v2-dependencies-python3.13- |
25 | | - |
26 | | - - run: |
27 | | - name: Install dependencies |
28 | | - command: | |
29 | | - uv venv --allow-existing |
30 | | - source .venv/bin/activate |
31 | | -
|
32 | | - uv pip install -r requirements-dev.txt |
33 | | - uv pip install -e .[all] |
34 | | -
|
35 | | - - save_cache: |
36 | | - paths: |
37 | | - - ./venv |
38 | | - key: v2-dependencies-python3.13-{{ checksum "setup.py" }}-{{ checksum "requirements-dev.txt" }} |
39 | | - |
40 | | - - run: |
41 | | - name: Build docs |
42 | | - command: | |
43 | | - source .venv/bin/activate |
44 | | -
|
45 | | - cd docs/ |
46 | | - make deploy_docs |
47 | | -
|
48 | | - - store_artifacts: |
49 | | - path: docs/html |
50 | | - |
51 | | - - persist_to_workspace: |
52 | | - root: . |
53 | | - paths: |
54 | | - - docs/html |
55 | | - |
56 | | - docs-build-deploy: |
57 | | - docker: |
58 | | - - image: cimg/node:current |
59 | | - |
60 | | - steps: |
61 | | - - checkout |
62 | | - |
63 | | - - attach_workspace: |
64 | | - at: . |
65 | | - |
66 | | - - run: |
67 | | - name: Validate build artifacts |
68 | | - command: | |
69 | | - if [ ! -f docs/html/index.html ]; then |
70 | | - echo "Error: docs/html/index.html not found! Build might have failed." |
71 | | - exit 1 |
72 | | - fi |
73 | | -
|
74 | | - - run: |
75 | | - name: Get Latest gh-pages Version |
76 | | - command: | |
77 | | - npm view gh-pages version > gh_pages_version.txt |
78 | | - cat gh_pages_version.txt |
79 | | -
|
80 | | - - run: |
81 | | - name: Setup NPM Path |
82 | | - command: | |
83 | | - npm set prefix=/home/circleci/npm |
84 | | - echo 'export PATH=/home/circleci/npm/bin:$PATH' >> $BASH_ENV |
85 | | -
|
86 | | - - run: |
87 | | - name: Setup git |
88 | | - command: | |
89 | | - git config --global user.email "ci-build@movementcooperative.org" |
90 | | - git config --global user.name "ci-build" |
91 | | - git config --global init.defaultBranch main |
92 | | -
|
93 | | - - restore_cache: |
94 | | - keys: |
95 | | - - v1-gh-pages-{{ checksum "gh_pages_version.txt" }}-{{ arch }} |
96 | | - |
97 | | - - run: |
98 | | - name: Install gh-pages |
99 | | - command: | |
100 | | - GH_VERSION=$(cat gh_pages_version.txt) |
101 | | - if [ ! -f /home/circleci/npm/bin/gh-pages ]; then |
102 | | - echo "Installing gh-pages version $GH_VERSION..." |
103 | | - npm install -g --silent gh-pages@$GH_VERSION |
104 | | - fi |
105 | | -
|
106 | | - - save_cache: |
107 | | - key: v1-gh-pages-{{ checksum "gh_pages_version.txt" }}-{{ arch }} |
108 | | - paths: |
109 | | - - /home/circleci/npm |
110 | | - |
111 | | - - add_ssh_keys: |
112 | | - # This SSH key is "CircleCI Docs" in https://github.com/move-coop/parsons/settings/keys |
113 | | - # We need write access to the Parsons repo, so we can push the "gh-pages" branch. |
114 | | - fingerprints: |
115 | | - - '9a:ec:4d:2b:c3:45:b2:f5:55:ca:0b:2b:36:e2:7f:df' |
116 | | - |
117 | | - - run: |
118 | | - name: Deploy docs |
119 | | - environment: |
120 | | - CACHE_DIR: /home/circleci/gh-pages-cache |
121 | | - command: | |
122 | | - OPTIONS=( |
123 | | - "--dist" "docs/html" |
124 | | - "--message" "[skip ci] Updates" |
125 | | - "--dotfiles" |
126 | | - "--nojekyll" |
127 | | - ) |
128 | | - if [ "$CIRCLE_BRANCH" != "main" ]; then |
129 | | - echo "Verifying gh-pages execution without publishing." |
130 | | - FAKE_REMOTE="/tmp/fake-remote" |
131 | | - mkdir -p "$FAKE_REMOTE" |
132 | | - git init --bare "$FAKE_REMOTE" |
133 | | - gh-pages "${OPTIONS[@]}" --repo "$FAKE_REMOTE" |
134 | | - else |
135 | | - echo "Publishing with gh-pages." |
136 | | - gh-pages "${OPTIONS[@]}" |
137 | | - fi |
0 commit comments