2020-05-02 11:25:57 +02:00
|
|
|
version: 2.1
|
2019-04-11 15:48:36 +02:00
|
|
|
|
2019-04-10 18:17:24 +02:00
|
|
|
jobs:
|
2020-01-07 10:54:51 +01:00
|
|
|
deploy:
|
2019-07-25 16:14:37 +02:00
|
|
|
docker:
|
2020-09-27 13:00:14 +02:00
|
|
|
- image: cimg/base:2020.09
|
|
|
|
working_directory: ~/website
|
2019-07-25 16:14:37 +02:00
|
|
|
steps:
|
2019-09-09 20:01:22 +02:00
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
2020-09-27 13:00:14 +02:00
|
|
|
- install_mc
|
2019-08-30 12:33:00 +02:00
|
|
|
- run:
|
2020-05-02 20:17:07 +02:00
|
|
|
name: Set build environment depending on branch
|
2019-08-30 12:33:00 +02:00
|
|
|
command: |
|
2019-09-14 14:55:04 +02:00
|
|
|
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
2020-05-02 20:17:07 +02:00
|
|
|
cat >> $BASH_ENV \<< EOF
|
|
|
|
export SITEURL="https://www.offen.dev"
|
2020-09-27 13:00:14 +02:00
|
|
|
export BUCKET="web-production"
|
2020-05-02 20:17:07 +02:00
|
|
|
export ROBOTS_FILE="robots.txt.production"
|
|
|
|
export OFFEN_ACCOUNT_ID="5ec8345a-2a45-4eb9-92e5-8d9e5684db58"
|
|
|
|
EOF
|
2019-09-14 14:55:04 +02:00
|
|
|
else
|
2020-05-02 20:17:07 +02:00
|
|
|
cat >> $BASH_ENV \<< EOF
|
|
|
|
export SITEURL="https://staging.offen.dev"
|
2020-09-27 13:00:14 +02:00
|
|
|
export BUCKET="web-staging"
|
2020-05-02 20:17:07 +02:00
|
|
|
export DISTRIBUTION="E13I20LK8ASYFH"
|
|
|
|
export ROBOTS_FILE="robots.txt.staging"
|
|
|
|
export OFFEN_ACCOUNT_ID="8f7ee44a-4cd8-47f2-a77e-8c7c98d46b89"
|
|
|
|
EOF
|
2019-09-14 14:55:04 +02:00
|
|
|
fi
|
2020-05-02 20:17:07 +02:00
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: make build
|
|
|
|
- run:
|
2020-09-27 13:00:14 +02:00
|
|
|
name: Deploy to Storage
|
2020-05-02 20:17:07 +02:00
|
|
|
command: |
|
2020-09-27 13:00:14 +02:00
|
|
|
mc mirror --remove --overwrite ./output/ offen/$BUCKET
|
2019-07-25 16:14:37 +02:00
|
|
|
|
2019-04-11 15:48:36 +02:00
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-10-08 19:46:02 +02:00
|
|
|
build_deploy:
|
2019-04-11 15:48:36 +02:00
|
|
|
jobs:
|
2019-09-09 20:01:22 +02:00
|
|
|
- deploy:
|
2020-09-27 13:00:14 +02:00
|
|
|
context: Storage
|
2020-01-07 10:54:51 +01:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- development
|
2020-05-02 11:25:57 +02:00
|
|
|
|
2020-09-27 13:00:14 +02:00
|
|
|
commands:
|
|
|
|
install_mc:
|
|
|
|
description: Install MinIO client
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Download client
|
|
|
|
working_directory: '~'
|
|
|
|
command: |
|
|
|
|
curl https://dl.min.io/client/mc/release/linux-amd64/mc -o mc
|
|
|
|
chmod +x mc
|
|
|
|
sudo mv mc /usr/local/bin/mc
|
|
|
|
command -v mc
|