Skip to content

Commit 320d417

Browse files
committed
♻️ Reorder CircleCI config to get existing docs before checking versions
1 parent 07a0396 commit 320d417

File tree

1 file changed

+37
-42
lines changed

1 file changed

+37
-42
lines changed

.circleci/config.yml

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ commands:
55
- run:
66
name: 🔧 Setting version
77
command: if [ -f /build/build_version.txt ]; then echo "export BUILD_VERSION=$(cat /build/build_version.txt)" >> $BASH_ENV; else echo "export BUILD_VERSION=nightly" >> $BASH_ENV; fi
8-
install-dependencies:
8+
install-build-dependencies:
99
parameters:
1010
version:
1111
type: string
1212
steps:
1313
- run:
14-
name: ↑ Installing dependencies
14+
name: ↑ Installing build dependencies
1515
command: |
16-
apt-get update && apt-get -y install git rsync python-dev graphviz libgraphviz-dev pkg-config python3-sphinx
16+
apt-get update && apt-get -y install git python-dev graphviz libgraphviz-dev pkg-config python3-sphinx
1717
pip install --user -r https://raw.githubusercontent.com/FCP-INDI/C-PAC/<< parameters.version >>/requirements.txt
1818
pip install --user git+https://github.com/${CIRCLE_PROJECT_USERNAME}/C-PAC.git@<< parameters.version >> sphinx m2r numpydoc PyGithub sphinxcontrib-fulltoc sphinxcontrib-programoutput torch
1919
git clone https://github.com/${CIRCLE_PROJECT_USERNAME}/C-PAC.git /build/C-PAC
@@ -43,17 +43,21 @@ commands:
4343
cpac utils --help | sed -e "s/.*/ &/" >> docs/_sources/user/utils/help.rst
4444
deactivate
4545
prep-deploy:
46-
parameters:
47-
version:
48-
type: string
4946
steps:
50-
- install-dependencies:
51-
version: << parameters.version >>
47+
- run:
48+
name: ↑ Installing deploy dependencies
49+
command: apt-get update && apt-get -y install git rsync
5250
- run:
5351
name: 🔧 Configuring git user
5452
command: |
5553
git config --global user.email "[email protected]"
5654
git config --global user.name "ci-build"
55+
- run:
56+
name: 🔀 Combining new docs with existing docs
57+
command: |
58+
cd /build
59+
git clone --single-branch --branch master [email protected]:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git /tmp/repo || git clone --single-branch --branch master [email protected]:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git /tmp/repo
60+
rsync -rtv ./ /tmp/repo/ --exclude '.git'
5761
- run:
5862
name: 📑 Generating list of versions
5963
command: python /build/scripts/version_list.py
@@ -62,9 +66,6 @@ commands:
6266
- run:
6367
name: 🚀 Deploying docs
6468
command: |
65-
cd /build
66-
git clone --single-branch --branch master [email protected]:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git /tmp/repo || git clone --single-branch --branch master [email protected]:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git /tmp/repo
67-
rsync -rtv ./ /tmp/repo/ --exclude '.git'
6869
cd /tmp/repo
6970
git rm -f .gitignore || rm -f .gitignore || true
7071
git add .
@@ -80,6 +81,23 @@ commands:
8081
git commit -m "$(cat /root/GITMESSAGE.txt)" --allow-empty
8182
git push origin HEAD:master -f
8283
cd -
84+
store-commit-message:
85+
steps:
86+
- run:
87+
name: 📑 Storing commit message
88+
command: git log origin/source -1 --oneline --pretty=%s > /root/GITMESSAGE.txt
89+
persist-new-build:
90+
steps:
91+
- persist_to_workspace:
92+
root: /
93+
paths:
94+
- build/404.html
95+
- build/build_version.txt
96+
- build/docs
97+
- build/index.html
98+
- build/scripts
99+
- root/.ssh
100+
- root/GITMESSAGE.txt
83101

84102
jobs:
85103
build-nightly:
@@ -88,24 +106,14 @@ jobs:
88106
- image: python:3.7
89107
steps:
90108
- checkout
91-
- install-dependencies:
109+
- install-build-dependencies:
92110
version: develop
93111
- run-cpac-commands
94112
- run:
95113
name: 🏗️ Building nightly branch docs
96114
command: ./bin/build nightly
97-
- run:
98-
name: Storing commit message
99-
command: git log origin/source -1 --oneline --pretty=%s > /root/GITMESSAGE.txt
100-
- persist_to_workspace:
101-
root: /
102-
paths:
103-
- build/404.html
104-
- build/docs
105-
- build/index.html
106-
- build/scripts
107-
- root/.ssh
108-
- root/GITMESSAGE.txt
115+
- store-commit-message
116+
- persist-new-build
109117

110118
build-version:
111119
working_directory: /build
@@ -117,25 +125,14 @@ jobs:
117125
name: 🔬 Checking for tag file
118126
command: test -f ./build_version.txt
119127
- get-version
120-
- install-dependencies:
128+
- install-build-dependencies:
121129
version: ${BUILD_VERSION}
122130
- run-cpac-commands
123131
- run:
124132
name: 🏗️ Building version branch docs
125133
command: ./bin/build ${BUILD_VERSION}
126-
- run:
127-
name: 📑 Storing commit message
128-
command: git log origin/source -1 --oneline --pretty=%s > /root/GITMESSAGE.txt
129-
- persist_to_workspace:
130-
root: /
131-
paths:
132-
- build/404.html
133-
- build/build_version.txt
134-
- build/docs
135-
- build/index.html
136-
- build/scripts
137-
- root/.ssh
138-
- root/GITMESSAGE.txt
134+
- store-commit-message
135+
- persist-new-build
139136

140137
deploy-nightly:
141138
working_directory: /
@@ -144,8 +141,7 @@ jobs:
144141
steps:
145142
- attach_workspace:
146143
at: /
147-
- prep-deploy:
148-
version: develop
144+
- prep-deploy
149145
- deploy
150146

151147
deploy-version:
@@ -156,8 +152,7 @@ jobs:
156152
- attach_workspace:
157153
at: /
158154
- get-version
159-
- prep-deploy:
160-
version: ${BUILD_VERSION}
155+
- prep-deploy
161156
- run:
162157
name: 🔖 Checking if latest
163158
command: if $(python /build/scripts/is_latest.py); then cp -r /build/docs/${BUILD_VERSION} /build/docs/latest; fi

0 commit comments

Comments
 (0)