Example of CircleCI deployment through CircleCI v2 (#7024)
Merge pull request 7024
This commit is contained in:
parent
caae9d2eca
commit
e418d9b2f4
|
@ -61,7 +61,7 @@ test:
|
|||
|
||||
## Complete Example circle.yml File
|
||||
|
||||
When you put it all together, here's an example of what that `circle.yml` file could look like:
|
||||
When you put it all together, here's an example of what that `circle.yml` file could look like in v1:
|
||||
|
||||
```yaml
|
||||
machine:
|
||||
|
@ -83,6 +83,75 @@ deployment:
|
|||
- rsync -va --delete ./_site username@my-website:/var/html
|
||||
```
|
||||
|
||||
for CircleCI v2, a Docker-based system which new projects will follow, set the `S3_BUCKET_NAME` environment variable (an example of the required config file is shown below).
|
||||
|
||||
```yaml
|
||||
defaults: &defaults
|
||||
working_directory: ~/repo
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/ruby:2.5
|
||||
environment:
|
||||
BUNDLE_PATH: ~/repo/vendor/bundle
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- rubygems-v1-{{ checksum "Gemfile.lock" }}
|
||||
- rubygems-v1-fallback
|
||||
- run:
|
||||
name: Bundle Install
|
||||
command: bundle check || bundle install
|
||||
- run:
|
||||
name: HTMLProofer tests
|
||||
command: |
|
||||
bundle exec htmlproofer ./_site \
|
||||
--allow-hash-href \
|
||||
--check-favicon \
|
||||
--check-html \
|
||||
--disable-external
|
||||
- save_cache:
|
||||
key: rubygems-v1-{{ checksum "Gemfile.lock" }}
|
||||
paths:
|
||||
- vendor/bundle
|
||||
- run:
|
||||
name: Jekyll build
|
||||
command: bundle exec jekyll build
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- _site
|
||||
deploy:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/python:3.6.3
|
||||
environment:
|
||||
S3_BUCKET_NAME: <<YOUR BUCKET NAME HERE>>
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Install AWS CLI
|
||||
command: pip install awscli --upgrade --user
|
||||
- run:
|
||||
name: Upload to s3
|
||||
command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --delete --acl public-read
|
||||
workflows:
|
||||
version: 2
|
||||
test-deploy:
|
||||
jobs:
|
||||
- build
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
```
|
||||
|
||||
## Questions?
|
||||
|
||||
This entire guide is open-source. Go ahead and [edit it][7] if you have a fix or [ask for help][8] if you run into trouble and need some help. CircleCI also has an [online community][9] for help.
|
||||
|
|
Loading…
Reference in New Issue