publish mkdocs wiki #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: publish mkdocs wiki | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout the gitbook repo | |
uses: actions/checkout@v2 | |
with: | |
repository: indiainvestments/content | |
path: gitbookwiki | |
- name: checkout the mkdocs repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
path: mkdocswiki | |
- name: setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: upgrade pip, install mkdocs material, and some extensions | |
run: >- | |
python -m pip install --upgrade pip mkdocs-material | |
mkdocs-git-revision-date-localized-plugin | |
- name: copy over content from gitbook to mkdocs | |
run: | | |
cp -f gitbookwiki/README.md mkdocswiki/docs/README.md | |
cp -f gitbookwiki/disclaimers-and-disclosures.md mkdocswiki/docs/disclaimers-and-disclosures.md | |
rsync -Pra --delete gitbookwiki/bonds/ mkdocswiki/docs/bonds | |
rsync -Pra --delete gitbookwiki/contributors/ mkdocswiki/docs/contributors | |
rsync -Pra --delete gitbookwiki/discord-and-reddit/ mkdocswiki/docs/discord-and-reddit | |
rsync -Pra --delete gitbookwiki/excel/ mkdocswiki/docs/excel | |
rsync -Pra --delete gitbookwiki/faqs/ mkdocswiki/docs/faqs | |
rsync -Pra --delete gitbookwiki/how-to/ mkdocswiki/docs/how-to | |
rsync -Pra --delete gitbookwiki/misc/ mkdocswiki/docs/misc | |
rsync -Pra --delete gitbookwiki/start-here/ mkdocswiki/docs/start-here | |
rsync -Pra --delete gitbookwiki/stocks/ mkdocswiki/docs/stocks | |
rsync -Pra --delete gitbookwiki/.gitbook/assets/*.png mkdocswiki/docs/images | |
rsync -Pra --delete gitbookwiki/.gitbook/assets/*.jpeg mkdocswiki/docs/images | |
rsync -Pra --delete gitbookwiki/.gitbook/assets/*.csv mkdocswiki/docs/files | |
rm -rf gitbookwiki/ | |
- name: deploy pandoc to convert gitbook markdown to mkdocs markdown | |
uses: docker://pandoc/core:2.14.0.1 | |
with: | |
entrypoint: /bin/sh | |
args: >- | |
-c "find mkdocswiki/docs/ -name '*.md' -type f -exec pandoc | |
--wrap=preserve -s -f markdown-smart | |
-t markdown_strict+yaml_metadata_block+pipe_tables+tex_math_dollars | |
{} -o {} \;" | |
- name: use sed operations to convert gitbook markdown to mkdocs markdown | |
run: | | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops spaces {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops endhint {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops replace {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops img {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops imgclass {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops pref {} \; | |
find mkdocswiki/docs -name "*.md" -type f -exec mkdocswiki/docs/files/sedops ytfix {} \; | |
- name: add the changes to git, commit them, and push | |
run: | | |
git --work-tree=mkdocswiki/ --git-dir=mkdocswiki/.git/ config user.name github-actions[bot] | |
git --work-tree=mkdocswiki/ --git-dir=mkdocswiki/.git/ config user.email github-actions[bot]@users.noreply.github.com | |
git --work-tree=mkdocswiki/ --git-dir=mkdocswiki/.git/ add -A || true | |
git --work-tree=mkdocswiki/ --git-dir=mkdocswiki/.git/ commit -m "markdown sanitized" || true | |
git --work-tree=mkdocswiki/ --git-dir=mkdocswiki/.git/ push origin master || true | |
- name: deploy mkdocs in gh-pages | |
run: | | |
cd mkdocswiki/ | |
mkdocs gh-deploy --force |