vaguerent/.circleci/config.yml
2020-06-29 18:12:44 -04:00

56 lines
1.7 KiB
YAML

version: 2
jobs:
build-website-docker-image:
docker:
- image: circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker Image if Necessary
command: |
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
echo "Using $IMAGE_TAG"
if curl https://hub.docker.com/v2/repositories/hashicorp/vagrant-website/tags/$IMAGE_TAG -fsL > /dev/null; then
echo "Dependencies have not changed, not building a new website docker image."
else
cd website/
docker build -t hashicorp/vagrant-website:$IMAGE_TAG .
docker tag hashicorp/vagrant-website:$IMAGE_TAG hashicorp/vagrant-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/vagrant-website
fi
algolia-index:
docker:
- image: node:12
steps:
- checkout
- run:
name: Push content to Algolia Index
command: |
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vagrant.git" ]; then
echo "Not Vagrant OSS Repo, not indexing Algolia"
exit 0
fi
cd website/
npm install
node scripts/index_search_content.js
workflows:
version: 2
build_website_docker_image:
jobs:
- build-website-docker-image:
filters:
branches:
only:
- master
algolia_index:
jobs:
- algolia-index:
filters:
branches:
only:
- stable-website