Files
offline_kubespray/collection/community/mongodb/.github/workflows/documentation.yml
ByeonJungHun 360c6eef4a offline 작업
2024-02-19 16:02:29 +09:00

86 lines
3.1 KiB
YAML

name: documentation
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ansible_collections/community/mongodb
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ansible_collections/community/mongodb
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install ansible-base (devel)
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
- name: Build collection
run: ansible-galaxy collection build .
- name: Install collection
run: ansible-galaxy collection install community-mongodb-*.tar.gz
- name: Install ansible-doc-extractor
run: pip install wheel setuptools ansible-doc-extractor --upgrade
- name: Install rstdoc
run: pip install -v rstdoc
- name: Create docs dir
run: mkdir -p docs/{lookup,cache}
- name: Create rst files from modules
run: ansible-doc-extractor ./docs plugins/modules/mongodb_*.py
- name: Create rst files from lookup
run: ansible-doc-extractor ./docs/lookup plugins/lookup/mongodb*.py
- name: Create rst files from cache
run: ansible-doc-extractor ./docs/cache plugins/cache/mongodb*.py
- name: Create collection index document
run: |
echo "# MongoDB Ansible Collection Documentation" > docs/index.md
echo "## Modules" >> docs/index.md
find plugins/modules -type f -name 'mongodb_*.py' -exec bash -c 'echo "- [$(basename "{}" ".py")]($(basename {} .py).html)"' \; >> docs/index.md
echo "## Lookup" >> docs/index.md
find plugins/lookup -type f -name 'mongodb*.py' -exec bash -c 'echo "- [$(basename "{}" ".py")](lookup/$(basename {} .py).html)"' \; >> docs/index.md
echo "## Cache" >> docs/index.md
find plugins/cache -type f -name 'mongodb*.py' -exec bash -c 'echo "- [$(basename "{}" ".py")](cache/$(basename {} .py).html)"' \; >> docs/index.md
- name: Create module html documents from rst files
run: |
find ./docs -type f -name 'mongodb_*.rst' -maxdepth 1 -exec bash -c 'rstdoc {} "docs/$(basename "{}" ".rst").html" rst_html' \;
- name: Create lookup html documents from rst files
run: |
find ./docs/lookup -type f -name 'mongodb*.rst' -maxdepth 1 -exec bash -c 'rstdoc {} "docs/lookup/$(basename "{}" ".rst").html" rst_html' \;
- name: Create cache html documents from rst files
run: |
find ./docs/cache -type f -name 'mongodb*.rst' -maxdepth 1 -exec bash -c 'rstdoc {} "docs/cache/$(basename "{}" ".rst").html" rst_html' \;
- name: Remove intermediary rst docs
run: find docs/ -name '*.rst' -delete
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@v1
with:
target_branch: gh-pages
build_dir: ansible_collections/community/mongodb/docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}