Skip to content

Commit 048b58d

Browse files
authored
Merge pull request #19315 from cockroachdb/ci/add-teamcity-build-script
ci: add TeamCity build script for post-merge algolia index updation
2 parents cebbb8e + d430193 commit 048b58d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Set the site URL for Jekyll
4+
site_url="https://www.cockroachlabs.com"
5+
JEKYLL_ENV="production"
6+
echo "Setting site domain to cockroachlabs.com and JEKYLL_ENV to production"
7+
8+
# Generate the _config_url.yml file
9+
echo "url: ${site_url}" > _config_url.yml
10+
11+
# Function to build the site
12+
function build {
13+
bundle exec jekyll build --trace --config _config_base.yml,$1
14+
if [[ $? != 0 ]]; then
15+
echo "Jekyll build failed."
16+
exit 1
17+
fi
18+
}
19+
20+
# Install dependencies
21+
echo "Installing dependencies..."
22+
gem install bundler --silent
23+
bundle install --quiet
24+
25+
# Build the site
26+
echo "Building the site..."
27+
build _config_cockroachdb.yml,_config_url.yml
28+
29+
# Copy necessary files for redirects and 404 handling
30+
echo "Copying redirects and 404 page..."
31+
cp _site/docs/_redirects _site/_redirects
32+
cp _site/docs/404.html _site/404.html
33+
34+
# Build the Algolia index
35+
echo "Building Algolia index..."
36+
if [[ -z "${PROD_ALGOLIA_API_KEY}" ]]; then
37+
echo "Error: PROD_ALGOLIA_API_KEY is not set. Exiting..."
38+
exit 1
39+
fi
40+
41+
ALGOLIA_API_KEY=${PROD_ALGOLIA_API_KEY} ALGOLIA_LOG_LEVEL=debug bundle exec jekyll algolia --config _config_base.yml,_config_url.yml --builds-config _config_cockroachdb.yml
42+
if [[ $? != 0 ]]; then
43+
echo "Algolia index build failed."
44+
exit 1
45+
fi
46+
47+
echo "Build completed successfully."

0 commit comments

Comments
 (0)