-
Notifications
You must be signed in to change notification settings - Fork 19
Overview of Archipelago Documentation
Albert Min edited this page Aug 26, 2022
·
1 revision
- https://github.com/esmero/archipelago-deployment
- https://github.com/esmero/archipelago-deployment-live
- mkdocs for generating the static site
- mkdocs-material for the theme
- mike for the versioning
- Github Actions for deploying to Github Pages
The final built site is deployed on the gh-pages
branch. If the build process goes awry and clobbers the site, folder/file structure, etc., you can push to this branch with the correctly built site.
During the CI's automated deployment some commands are run to copy over files from the deployment repos and make some file name and text edits. Among these are the following:
- The main repo READMEs are normalized (lower case) and prepended with the repo names:
cp ./archipelago-deployment/README.md ./tmp-update-repo/docs/archipelago-deployment-readme.md cp ./archipelago-deployment-live/README.md ./tmp-update-repo/docs/archipelago-deployment-live-readme.md
- For each markdown file in the
docs
folder, the repo name is prepended to the file name before being copied to the main documenation repo. Additionally, any linked references in the same documents are updated (sed
commands):for f in ./archipelago-deployment/docs/*.md; do cp -- "$f" "./tmp-update-repo/docs/archipelago-deployment-$(basename $f)"; done for f in ./archipelago-deployment/docs/*.md; do for g in ./archipelago-deployment/docs/*.md; do sed -i "s/$(basename $g)/archipelago-deployment-$(basename $g)/g" "./tmp-update-repo/docs/archipelago-deployment-$(basename $f)"; done; done for f in ./archipelago-deployment-live/docs/*.md; do cp -- "$f" "./tmp-update-repo/docs/archipelago-deployment-live-$(basename $f)"; done for f in ./archipelago-deployment-live/docs/*.md; do for g in ./archipelago-deployment-live/docs/*.md; do sed -i "s/$(basename $g)/archipelago-deployment-live-$(basename $g)/g" "./tmp-update-repo/docs/archipelago-deployment-live-$(basename $f)"; done; done
- So the deployment repo docs can be encoded with frontmatter (titles, tags, and any other metadata) without having it appear in the docs when read directly on the repos themselves, some commented out sections are uncommented with
sed
commands as they are copied to the documentation repo:Here is an example of the commented out frontmatter before thesed -i '/<!--documentation/d;/documentation-->/d;s/docs\//archipelago-deployment-/g' docs/archipelago-deployment-*.md
sed
command uncomments them:<!--documentation --- title: "Adding Demo Archipelago Digital Objects (ADOs) to your Repository" tags: - Archipelago Digital Objects - Demo Content --- documentation-->
- In a similar fashion to above, there is some theme-specific syntax (like admonitions as in this example) that are switched out with
sed
commands:And below is an example of the commented out sections that are switched out with thesed -i '/<!--switch_below/d;/<!--switch_above/d;s/switch_above-->/repo_docs-->/g;s/switch_below-->/<!--repo_docs/g' docs/archipelago-deployment-*.md
sed
command above:Everything between the<!--switch_below ??? info "OSX (macOS)/x86-64" ```shell cp docker-compose-osx.yml docker-compose.yml ``` ??? info "Linux/x86-64/AMD64" ```shell cp docker-compose-linux.yml docker-compose.yml ``` ??? info "OSX (macOS)/Linux/ARM64" ```shell cp docker-compose-arm64.yml docker-compose.yml ``` switch_below--> ___ OSX (macOS)/x86-64: ```shell cp docker-compose-osx.yml docker-compose.yml ``` ___ Linux/x86-64/AMD64: ```shell cp docker-compose-linux.yml docker-compose.yml ``` ___ OSX (macOS)/Linux/ARM64: ```shell cp docker-compose-arm64.yml docker-compose.yml ``` ___ <!--switch_above switch_above-->
switch_below
tags is uncommented to be processed by the theme, and everything between theswitch_below
tag closure and theswitch_above
tags is commented out, i.e. switched out with the following result:??? info "OSX (macOS)/x86-64" ```shell cp docker-compose-osx.yml docker-compose.yml ``` ??? info "Linux/x86-64/AMD64" ```shell cp docker-compose-linux.yml docker-compose.yml ``` ??? info "OSX (macOS)/Linux/ARM64" ```shell cp docker-compose-arm64.yml docker-compose.yml ``` <!--repo_docs ___ OSX (macOS)/x86-64: ```shell cp docker-compose-osx.yml docker-compose.yml ``` ___ Linux/x86-64/AMD64: ```shell cp docker-compose-linux.yml docker-compose.yml ``` ___ OSX (macOS)/Linux/ARM64: ```shell cp docker-compose-arm64.yml docker-compose.yml ``` ___ repo_docs-->
- First create the new documentation release branch, e.g.
1.1.0
, at the main documentation repo. - Update all references from the old branch to the new branch, e.g.
1.0.0
to1.1.0
, in the CI YAML file (.github/workflows/ci.yml
) for the main documentation repo. - Push changes or merge pull request for the CI file and new release branch.
- Update references in the CI YAML file (
.github/workflows/ci.yml
) for repo branches that trigger the documentation repo CI and push changes/merge pull request. - If all goes well, both the main READMEs and any documentation in the
docs
folder should automatically have copied over to the main documentation repo, and the log for the CI being triggered will be here.
- Version branches each have a file in the root folder to trigger the workflow:
.github/workflows/ci.yml
- The mkdocs configuration file, which determines the plugins, theme (mkdocs-material), table of contents, icons, layout, etc. is also at root:
mkdocs.yml
- The
CNAME
file contains the site subdomain and should not be changed or moved. - The actual documentation pages are all markdown files in the
docs
folder. - Any images should be put in the
images
(subfolder todocs
) folder and added to pages with relative path.
- Fork/clone the docs branch (currently only 1.0.0):
git clone https://github.com/esmero/archipelago-documentation.git
- Create or update an existing markdown file.
- To add tags to the page, create frontmatter at the top of the page with a title and list of tags, e.g.:
--- title: "Archipelago-deployment for Drupal 9" tags: - Archipelago-deployment - Drupal 9 - Docker ---
- For horizontal rule use
___
instead of---
(because the latter is interpreted as frontmatter).
- To add tags to the page, create frontmatter at the top of the page with a title and list of tags, e.g.:
- Deploy and run locally.
- Install mkdocs-material (includes mkdocs), mike, and mkdocs-plugin-tags:
pip install mkdocs-material mike git+https://github.com/jldiaz/mkdocs-plugin-tags.git
- From root of project:
mike deploy --update-aliases BRANCH/VERSION-ALIAS
(use --push flag to push changes to repo) - If setting default version:
mike set-default BRANCH/VERSION-ALIAS
(use --push flag to push changes to repo) mike serve
- Go to http://localhost:8000 in your browser and check that everything looks/works ok.
- Install mkdocs-material (includes mkdocs), mike, and mkdocs-plugin-tags:
- Push to your forked repo and make a PR.