2019-05-31 17:06:54 +02:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- gh-pages
|
|
|
|
docker:
|
|
|
|
- image: circleci/python:3.6
|
|
|
|
working_directory: ~/repo
|
|
|
|
environment:
|
|
|
|
- SOURCE_BRANCH: master
|
|
|
|
- TARGET_BRANCH: gh-pages
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- deploy:
|
|
|
|
name: Deploy
|
|
|
|
command: |
|
|
|
|
if [ $CIRCLE_BRANCH == $SOURCE_BRANCH ]; then
|
2019-05-31 17:22:09 +02:00
|
|
|
python -m venv venv
|
|
|
|
source venv/bin/activate
|
2019-05-31 17:29:06 +02:00
|
|
|
pip install -r requirements.txt
|
2019-05-31 17:18:32 +02:00
|
|
|
|
2019-05-31 17:06:54 +02:00
|
|
|
git config --global user.email $GH_EMAIL
|
|
|
|
git config --global user.name $GH_NAME
|
|
|
|
|
|
|
|
git clone $CIRCLE_REPOSITORY_URL out
|
|
|
|
|
|
|
|
cd out
|
|
|
|
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
|
|
|
|
git rm -rf .
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
make publish
|
|
|
|
|
|
|
|
cp -a output/. out/.
|
|
|
|
|
|
|
|
mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/.
|
|
|
|
cd out
|
|
|
|
|
|
|
|
git add -A
|
|
|
|
git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty
|
|
|
|
|
|
|
|
git push origin $TARGET_BRANCH
|
|
|
|
fi
|