Merge pull request #10422 from hashicorp/circleci-website-build

add circleci website build
This commit is contained in:
Chris Roberts 2018-11-16 12:18:54 -08:00 committed by GitHub
commit 45766ad00e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 36 deletions

42
.circleci/config.yml Normal file
View File

@ -0,0 +1,42 @@
version: 2
jobs:
build-website:
# setting the working_directory along with the checkout path allows us to not have
# to cd into the website/ directory for commands
working_directory: ~/project/website
docker:
- image: hashicorp/middleman-hashicorp:0.3.35
steps:
- checkout:
path: ~/project
# restores gem cache
- restore_cache:
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
- run:
command: bundle check || bundle install --path vendor/bundle
# saves gem cache if we have changed the Gemfile
- save_cache:
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
paths:
- ~/project/website/vendor/bundle
# middleman build
- run:
command: bundle exec middleman build
# website deploy
- run:
command: ./scripts/deploy.sh
workflows:
version: 2
website:
jobs:
- build-website:
context: static-sites
filters:
branches:
only: stable-website

View File

@ -1,36 +0,0 @@
{
"variables": {
"aws_access_key_id": "{{ env `AWS_ACCESS_KEY_ID` }}",
"aws_secret_access_key": "{{ env `AWS_SECRET_ACCESS_KEY` }}",
"aws_region": "{{ env `AWS_REGION` }}",
"website_environment": "production",
"fastly_api_key": "{{ env `FASTLY_API_KEY` }}"
},
"builders": [
{
"type": "docker",
"image": "hashicorp/middleman-hashicorp:0.3.35",
"discard": "true",
"volumes": {
"{{ pwd }}": "/website"
}
}
],
"provisioners": [
{
"type": "shell",
"environment_vars": [
"AWS_ACCESS_KEY_ID={{ user `aws_access_key_id` }}",
"AWS_SECRET_ACCESS_KEY={{ user `aws_secret_access_key` }}",
"AWS_REGION={{ user `aws_region` }}",
"ENV={{ user `website_environment` }}",
"FASTLY_API_KEY={{ user `fastly_api_key` }}"
],
"inline": [
"bundle check || bundle install",
"bundle exec middleman build",
"/bin/bash ./scripts/deploy.sh"
]
}
]
}