Skip to content

Commit

Permalink
feat(site): migrate documentation to Docsy
Browse files Browse the repository at this point in the history
update circleci config
  • Loading branch information
fhussonnois committed May 22, 2020
1 parent 1861db0 commit 2952571
Show file tree
Hide file tree
Showing 55 changed files with 4,635 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
# Use dedicated machine for testcontainer
# https://www.testcontainers.org/supported_docker_environment/continuous_integration/circle_ci/
executorType: machine
version: 2.1
executors:
default-executor:
machine:
image: ubuntu-1604:201903-01
node-executor:
docker:
- image: circleci/node:latest
jobs:
build:
# docker:
# # specify the version you desire here
# - image: circleci/openjdk:8-jdk

# Use dedicated machine for testcontainer
# https://www.testcontainers.org/supported_docker_environment/continuous_integration/circle_ci
executor: default-executor
working_directory: ~/repo

environment:
Expand Down Expand Up @@ -40,3 +43,24 @@ jobs:

- store_test_results:
path: target/surefire-reports
build-site:
executor: node-executor

working_directory: ~/repo

steps:
- checkout
- run:
name: Build and Deploy Site
command: ./build-deploy-site.sh
workflows:
version: 2
ci_build:
jobs:
- build
- build-site:
filters:
branches:
only: master
requires:
- build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "site/themes/docsy"]
path = site/themes/docsy
url = https://github.com/google/docsy.git
77 changes: 77 additions & 0 deletions build-deploy-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
#
# Copyright 2019-2020 StreamThoughts.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

last_commit="$(git diff --name-status HEAD~1 site | cat | grep 'site/')"

HUGO_BUILD_DIR=$(pwd)/docs/
HUGO_SOURCE_DIR=$(pwd)/site/
HUGO_VERSION=0.60.1
HUGO_DIST_DIR=/tmp/hugo/v${HUGO_VERSION}
HUGO_RELEASE=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz

# backup Git user info
GIT_USER_NAME=$(git config user.name)
GIT_USER_EMAIL=$(git config user.email)


build_and_deploy(){
echo "Buildind Hugo site"
rm -rf docs/*
rm $HUGO_DIST_DIR && mkdir -p $HUGO_DIST_DIR
git config --global user.email circleci@circleci
git config --global user.name CircleCI
# update hugo theme submodule
git submodule sync && git submodule update --init --recursive
# install hugo and build
wget $HUGO_RELEASE -P $HUGO_DIST_DIR && \
(cd $HUGO_DIST_DIR; tar -xzvf $HUGO_DIST_DIR/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz) && \
(cd $HUGO_SOURCE_DIR; sudo npm install) && \
HUGO_ENV=production $HUGO_DIST_DIR/hugo -v -s $HUGO_SOURCE_DIR -d $HUGO_BUILD_DIR
if [[ $? -eq 0 ]]; then
echo "Deploying site updates"
git add docs
git commit -m "docs(gh-pages): build and deploy site [skip ci]"
git push
else
echo "Hugo build failed"
fi
# reset git config
git config --global user.email $GIT_USER_EMAIL
git config --global user.name $GIT_USER_NAME
exit $?
}

if [ $# -eq 1 ]; then
case $1 in
--force)
build_and_deploy
;;
*)
echo "Unknown arg $1"
;;
esac
fi

if [[ ${last_commit} ]]; then
build_and_deploy
else
echo "Skipping site building, lastest commit message doesn't change path directory 'site/'"
fi

exit 0
217 changes: 217 additions & 0 deletions site/assets/icons/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions site/assets/scss/_buttons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.btn {
display: inline-flex;
align-items: center;
border: none;
border-radius: 4px;
color: #ffffff;
font-size: 16px;
font-weight: bold;
letter-spacing: 1.06px;
text-align: center;
text-transform: uppercase;
width: 186px;
height: 52px;
cursor: pointer;
justify-content: center;
padding-left: 0.8em;
padding-right: 0.8em;

&-github {
background-color: transparent;
border: solid 1px #ffffff;
color: #ffffff !important ;
}
}
Loading

0 comments on commit 2952571

Please sign in to comment.