Skip to content

Commit b741a0f

Browse files
committed
Merge branch 'main' into DOCSS-1854-html-proofer
2 parents 93fdb66 + 531998d commit b741a0f

File tree

12 files changed

+596
-490
lines changed

12 files changed

+596
-490
lines changed

.circleci/config.yml

Lines changed: 23 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
version: 2.1
22

3-
parameters:
4-
cleanup_preview_branch:
5-
type: string
6-
default: ""
7-
83
orbs:
94
aws-cli: circleci/[email protected]
105
vale: circleci/[email protected]
6+
go: circleci/[email protected]
117

128
executors:
139
node_executor:
1410
docker:
1511
- image: cimg/node:22.15.1
1612
working_directory: ~/project
1713

18-
python_executor:
14+
go_executor:
1915
docker:
20-
- image: cimg/python:3.12.11
16+
- image: cimg/go:1.24
2117
working_directory: ~/project
2218

2319
ruby_executor:
@@ -33,25 +29,6 @@ commands:
3329
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
3430
region: ${AWS_REGION}
3531

36-
sanitize-branch:
37-
steps:
38-
- run:
39-
name: Sanitize Branch Name
40-
command: |
41-
if [ -n "<< pipeline.parameters.cleanup_preview_branch >>" ]; then
42-
BRANCH_TO_USE="<< pipeline.parameters.cleanup_preview_branch >>"
43-
echo "[INFO] Using provided branch param: ${BRANCH_TO_USE}"
44-
else
45-
BRANCH_TO_USE="${CIRCLE_BRANCH}"
46-
echo "[INFO] Using current branch: ${BRANCH_TO_USE}"
47-
fi
48-
49-
# Replace forward-slashes and spaces with double underscore
50-
SANITIZED_BRANCH=$(echo "${BRANCH_TO_USE}" | tr '/ ' '__')
51-
echo "[INFO] Sanitized branch: ${SANITIZED_BRANCH}"
52-
echo "export SANITIZED_BRANCH=${SANITIZED_BRANCH}" >> $BASH_ENV
53-
source $BASH_ENV
54-
5532
notify_error:
5633
parameters:
5734
message:
@@ -93,21 +70,8 @@ jobs:
9370
echo "[INFO] Starting Antora build..."
9471
npm run build:docs
9572
echo "[INFO] Antora build completed."
96-
- run:
97-
name: Create ZIP Archive of Build
98-
command: |
99-
set -e
100-
echo "[INFO] Creating zip archive of build directory..."
101-
zip -r build.zip build/
10273
- store_artifacts:
103-
path: build.zip
104-
destination: preview-site.zip
105-
- persist_to_workspace:
106-
root: .
107-
paths:
108-
- build
109-
- build.zip
110-
- scripts
74+
path: build
11175
- persist_to_workspace:
11276
root: .
11377
paths:
@@ -142,148 +106,37 @@ jobs:
142106
- notify_error:
143107
message: "Validation job failed for branch ${CIRCLE_BRANCH}"
144108

145-
deploy-preview:
146-
executor: node_executor
147-
steps:
148-
- attach_workspace:
149-
at: .
150-
- sanitize-branch
151-
- run:
152-
name: Install GitHub CLI
153-
command: |
154-
set -e
155-
echo "[INFO] Installing GitHub CLI..."
156-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
157-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
158-
sudo apt update
159-
sudo apt install gh
160-
- run:
161-
name: Upload Preview ZIP to GitHub Release and Comment
162-
command: |
163-
set -e
164-
165-
if [[ -n "${CIRCLE_PULL_REQUEST}" ]]; then
166-
PR_NUMBER=$(echo "$CIRCLE_PULL_REQUEST" | sed 's|.*/pull/||')
167-
REPO_PATH="circleci/circleci-docs-static"
168-
TAG="pr-${SANITIZED_BRANCH}"
169-
170-
echo "[INFO] Creating release for PR #${PR_NUMBER} - branch ${SANITIZED_BRANCH} in ${REPO_PATH}"
171-
172-
# Check if release already exists (if re-run)
173-
if gh release view "${TAG}" -R "${REPO_PATH}" > /dev/null 2>&1; then
174-
echo "[INFO] Release already exists. Replacing..."
175-
gh release delete "${TAG}" -R "${REPO_PATH}" --yes
176-
fi
177-
178-
# Create new release and upload ZIP
179-
gh release create "${TAG}" build.zip \
180-
--repo "${REPO_PATH}" \
181-
--title "Preview for PR #${PR_NUMBER}" \
182-
--notes "ZIP artifact for documentation preview." \
183-
--prerelease
184-
185-
DOWNLOAD_URL="https://github.com/${REPO_PATH}/releases/tag/${TAG}/build.zip"
186-
187-
# Comment on the PR with release link
188-
gh pr comment "${PR_NUMBER}" -R "${REPO_PATH}" -b "## Preview Documentation
189-
190-
📦 ZIP preview available here: [Preview Build Assets](${DOWNLOAD_URL})
191-
192-
Build: ${CIRCLE_BUILD_NUM} | Commit: ${CIRCLE_SHA1}"
193-
else
194-
echo "[INFO] Not a PR build, skipping preview release."
195-
fi
196-
- notify_error:
197-
message: "Deploy preview job failed for branch ${CIRCLE_BRANCH}"
198-
199109
deploy-production:
200-
executor: python_executor
110+
executor: go_executor
201111
parameters:
202112
bucket_name:
203113
description: The name of the s3 bucket where static assets are stored.
204114
type: string
205-
build_dir:
206-
default: "build"
207-
description: The path to the docs build directory
208-
type: string
209115
steps:
116+
- checkout
210117
- attach_workspace:
211118
at: .
212119
- aws-setup
213-
- run:
214-
name: Deploy Production Site to S3
215-
command: |
216-
AWS_S3_BUCKET=<< parameters.bucket_name >>
217-
BUILD_DIRECTORY=<< parameters.build_dir >>
218-
219-
set -e
220-
echo "[INFO] Deploying production site..."
221-
aws s3 sync "$BUILD_DIRECTORY" "s3://$AWS_S3_BUCKET/"
222-
- run:
223-
name: install pyyaml requests
224-
command: |
225-
set -e
226-
echo "[INFO] Installing pyyaml requests..."
227-
pip install pyyaml requests
228-
- run:
229-
name: Deploy Redirects to S3
230-
command: |
231-
AWS_S3_BUCKET=<< parameters.bucket_name >>
232-
233-
set -e
234-
echo "[INFO] Deploying redirects..."
235-
#REMEMBER TO UPDATE THE START/END PARAMETER IN THE VALIDATE JOB TO MATCH
236-
python scripts/create-redirects.py $AWS_S3_BUCKET
237-
- run:
238-
name: Validate Redirects
239-
command: |
240-
set -e
241-
echo "[INFO] Validating redirects..."
242-
python scripts/validate-redirects.py https://circleci.com/docs-preview
120+
- go/with-cache:
121+
steps:
122+
- go/mod-download
123+
- run:
124+
name: Deploy Production Site to S3
125+
command: |
126+
echo "[INFO] Deploying production site..."
127+
dir=$(mktemp -d)
128+
mv build "${dir}/docs"
129+
aws s3 sync "${dir}" "s3://<< parameters.bucket_name >>/" \
130+
--delete
131+
- run:
132+
name: Deploy Redirects to S3
133+
command: go run ./cmd/create-redirects "<< parameters.bucket_name >>"
134+
- run:
135+
name: Validate Redirects
136+
command: go run ./cmd/validate-redirects https://circleci.com
243137
- notify_error:
244138
message: "Production deployment job failed for branch ${CIRCLE_BRANCH}"
245139

246-
cleanup-preview:
247-
executor: node_executor
248-
steps:
249-
- sanitize-branch
250-
- run:
251-
name: Install GitHub CLI
252-
command: |
253-
set -e
254-
echo "[INFO] Installing GitHub CLI..."
255-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
256-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
257-
sudo apt update
258-
sudo apt install gh
259-
- run:
260-
name: Delete GitHub Release and Tag
261-
command: |
262-
set -e
263-
BRANCH="<< pipeline.parameters.cleanup_preview_branch >>"
264-
REPO_PATH="circleci/circleci-docs-static"
265-
266-
# Extract TAG
267-
TAG="pr-${SANITIZED_BRANCH}"
268-
269-
echo "[INFO] Cleaning up GitHub Release for ${TAG} in ${REPO_PATH}"
270-
271-
# Delete the release if it exists
272-
if gh release view "${TAG}" -R "${REPO_PATH}" > /dev/null 2>&1; then
273-
gh release delete "${TAG}" -R "${REPO_PATH}" --yes
274-
echo "[INFO] Release '${TAG}' deleted."
275-
else
276-
echo "[WARN] Release '${TAG}' not found."
277-
fi
278-
279-
# Delete the tag if it exists
280-
if gh api -X GET "repos/${REPO_PATH}/git/refs/tags/${TAG}" > /dev/null 2>&1; then
281-
gh tag delete "${TAG}" -R "${REPO_PATH}" --yes
282-
echo "[INFO] Tag '${TAG}' deleted."
283-
else
284-
echo "[WARN] Tag '${TAG}' not found."
285-
fi
286-
287140
workflows:
288141
lint:
289142
unless:
@@ -293,25 +146,11 @@ workflows:
293146
reference_branch: main
294147
base_dir: docs
295148
build_validate_and_deploy:
296-
when:
297-
equal: ["", << pipeline.parameters.cleanup_preview_branch >>]
298149
jobs:
299150
- build:
300151
context: circleci-docs-static
301152
- validate:
302153
requires: [build]
303-
- deploy-preview:
304-
requires: [validate]
305-
filters:
306-
branches:
307-
ignore: main
308-
context:
309-
[
310-
circleci-docs-static,
311-
docs-platform-assets,
312-
web-ui-npm,
313-
web-ui-datadog,
314-
]
315154
- deploy-production:
316155
requires: [validate]
317156
filters:
@@ -325,9 +164,3 @@ workflows:
325164
web-ui-datadog,
326165
]
327166
bucket_name: "circleci-docs-platform-assets"
328-
build_dir: "build"
329-
cleanup_preview:
330-
when: pipeline.parameters.cleanup_preview_branch != ""
331-
jobs:
332-
- cleanup-preview:
333-
context: circleci-docs-static

antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
site:
22
title: CircleCI Documentation
3-
url: https://circleci.com/docs-preview
3+
url: https://circleci.com/docs
44
robots: allow
55
keys:
66
cookiebot: a28b71f3-4d2e-4eac-93bc-34929948dd7d

0 commit comments

Comments
 (0)