Skip to content
This repository has been archived by the owner on Dec 22, 2019. It is now read-only.

Commit

Permalink
Add auto deploy docs script
Browse files Browse the repository at this point in the history
  • Loading branch information
SaveTheAles committed Jun 20, 2019
1 parent 36fac87 commit 9a96f7f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 18 deletions.
29 changes: 16 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,37 @@ jobs:
update_doc:
working_directory: ~/build
docker:
- image: squidfunk/mkdocs-material
- image: circleci/golang:1.12
steps:
- checkout
- run:
name: Update Docs
working_directory: ~/workdir
command: |
git clone -q --depth 1 https://${DOCS_GITHUB_TOKEN}@github.com/cybercongress/library.git
cd ~/build
./script.sh
cd ~/workdir
git clone -q --depth 1 https://${DOCS_GITHUB_TOKEN}@github.com/cybercongress/congress.git
- deploy:
name: Update docs from js-amino repo
working_directory: ~/workdir/library
working_directory: ~/workdir/congress
command: |
# We need to remove current files in folder to avoid duplicating renamed files
rm -rf ./wiki/docs/js-amino/*
cp -r ~/build/docs/. ./wiki/docs/js-amino/
cp ~/build/README.md ./wiki/docs/js-amino/Overview.md
cp ~/build/CHANGELOG.md ./wiki/docs/js-amino/Changelog.md
cp ~/build/CONTRIBUTING.md ./wiki/docs/js-amino/Contributing.md
cp ~/build/img/. -r ./wiki/docs/js-amino/img/
git add -N wiki/docs/js-amino
diff=$(git diff wiki/docs/js-amino/)
rm -rf ./site/content/docs/cyberd/js-amino/*
cp -r ~/build/docs/. ./site/content/docs/cyberd/js-amino/
cp ~/build/README.md ./site/content/docs/cyberd/js-amino/Overview.md
cp ~/build/CHANGELOG.md ./site/content/docs/cyberd/Changelog.md
cp ~/build/CONTRIBUTING.md ./site/content/docs/cyberd/Contributing.md
cp ~/build/img/. -r ./site/content/docs/cyberd/img/.
git add -N site/content/docs/cyberd
diff=$(git diff site/content/docs/cyberdjs-amino/)
if [[ -n "$diff" ]]; then
git config user.email "cybercongress42@gmail.com"
git config user.name "Cyber Admin"
git add wiki/docs/js-amino/
git add site/content/docs/cyberd/js-amino/
git commit -m "Circle CI: Update Docs"
# Push quietly to prevent showing the token in log
git push -q https://${DOCS_GITHUB_TOKEN}@github.com/cybercongress/library.git master
git push -q https://${DOCS_GITHUB_TOKEN}@github.com/cybercongress/congress.git master
fi
workflows:
version: 2
Expand Down
5 changes: 0 additions & 5 deletions docs/js-amino.yml

This file was deleted.

6 changes: 6 additions & 0 deletions docs/menu/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
headless: true
---
- [Overview]({{< relref "/docs/js-amino/Overview.md" >}})
- [CHANGELOG]({{< relref "/docs/js-amino/Changelog.md" >}})
- [CONTRIBUTING]({{< relref "/docs/js-amino/Contributing.md" >}})
30 changes: 30 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
for file in ~/build/docs/*
do
if [ -f "$file" ]
then
touch temp.md
echo "---
project: js-amino
---" >> temp.md
cat $file >> temp.md
cat temp.md > $file
rm -rf temp.md
fi
done

touch temp.md
echo "---
project: js-amino
---" >> temp.md
cat CONTRIBUTING.md >> temp.md
cat temp.md > CONTRIBUTING.md
rm -rf temp.md

touch temp.md
echo "---
project: js-amino
---" >> temp.md
cat CHANGELOG.md >> temp.md
cat temp.md > CHANGELOG.md
rm -rf temp.md

0 comments on commit 9a96f7f

Please sign in to comment.