Skip to content

Commit 6262dc3

Browse files
committed
Adicionado CircleCI
1 parent 31f7b6d commit 6262dc3

File tree

6 files changed

+89
-19
lines changed

6 files changed

+89
-19
lines changed

.circleci/config.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/cci-demo-docker-primary:0.0.2
6+
7+
branches:
8+
only:
9+
- master
10+
11+
steps:
12+
- checkout
13+
14+
- run:
15+
name: Instalar cliente Docker
16+
command: |
17+
set -x
18+
VER="17.03.0-ce"
19+
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
20+
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
21+
mv /tmp/docker/* /usr/bin
22+
23+
- run:
24+
name: Instalar Docker Compose
25+
command: |
26+
set -x
27+
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
28+
chmod +x /usr/local/bin/docker-compose
29+
30+
- setup_remote_docker
31+
32+
- run:
33+
name: Build container
34+
command: |
35+
set -x
36+
docker-compose -f docker-circle.yaml up --build -d
37+
38+
- run:
39+
name: Espere container está pronto
40+
command: |
41+
set -x
42+
sleep 10
43+
44+
- run:
45+
name: Monte GitHub Pages
46+
command: |
47+
set -x
48+
./build.sh
49+
50+
- run:
51+
name: Deploy GitHub Pages
52+
command: |
53+
set -x
54+
git clone -b gh-pages https://github.com/victorhundo/docs.git /opt/gh-pages
55+
cp -rf ./_build/main/* /opt/gh-pages/
56+
cd /opt/gh-pages && git add .
57+
git -c user.name='CircleCI' -c user.email='travis' commit -m 'UPDATE GitHub Pages'
58+
git push
59+
60+
- store_artifacts:
61+
path: /tmp/test-results
62+
destination: raw-test-output
63+
64+
- store_test_results:
65+
path: /tmp/test-results

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM projectatomic/ascii_binder
2+
3+
WORKDIR /docs
4+
5+
RUN curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
6+
RUN curl -L https://get.rvm.io | bash -s stable
7+
8+
COPY . /docs
9+
CMD ["bash", "/docs/docker-entrypoint.sh"]

build.sh

100755100644
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
SITE_ROOT=$( echo "$(basename `git rev-parse --show-toplevel`)\/")
3+
SITE_ROOT=$( echo "$CIRCLE_PROJECT_REPONAME\/")
44
RED='\033[0;31m'
55
GREEN='\033[0;32m'
66
YELLOW='\033[1;33m'
@@ -11,22 +11,8 @@ function replace {
1111
find main -name '*.css' -type f -exec sed -i "s/$1/$2/g" '{}' \;
1212
}
1313

14-
15-
if [ ! -d "./_build/main" ]; then
16-
mkdir -p ./_build/main
17-
fi
18-
19-
docker-compose down && docker-compose up --build -d > /dev/null
20-
#Wait Docker is Ready!
21-
docker logs -f docs-asciidoctor | while read line
22-
do
23-
if echo $line | grep -q 'Guard is now watching'; then
24-
echo 'Server Started'
25-
LOG_PID=$(pgrep -f 'docker logs')
26-
kill -9 $LOG_PID;
27-
fi
28-
echo $line
29-
done
14+
docker cp docs-asciidoctor:/docs/_preview .
15+
mkdir -p ./_build/main
3016

3117
rm -rf ./_build/*
3218
cp -r ./_preview/main ./_build/
@@ -47,7 +33,6 @@ replace "_images" "imgs"
4733
cd - > /dev/null
4834

4935
cp -r ./_build /tmp
50-
git checkout gh-pages 2> /dev/null
5136
if [ $? -eq 0 ]; then
5237
cp -rf /tmp/_build/main/* . && rm -rf /tmp/_build
5338
printf "${GREEN}BUILD DONE!\n${RESET_COLOR}"

docker-circle.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '2'
2+
services:
3+
docs:
4+
build: .
5+
container_name: docs-asciidoctor
6+
image: circle-docs

docker-entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
cd /docs
4+
asciibinder clean && asciibinder build
5+
tail -f /dev/null

welcome/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[welcome-index]]
2-
= {product-title} Documentação {product-version}
2+
= {product-title} Documentação Teste de modificação {product-version}
33
{product-author}
44
{product-version}
55
:data-uri:

0 commit comments

Comments
 (0)