Skip to content

Commit

Permalink
Merge pull request #100 from GreenmaskIO/feature/auto-versioning-docs
Browse files Browse the repository at this point in the history
Feat: setting up multiple versions of documentation with mike plugin
  • Loading branch information
wwoytenko authored May 7, 2024
2 parents 082d02a + 3310937 commit ef3e2e9
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 167 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,38 @@ jobs:
- name: Install dependicies
run: pip install -r requirements.txt

- name: Setup docs deploy
run: |
git config --global user.name "Docs Deployer"
git config --global user.email [email protected]
echo "TAGS=$(git log --tags --simplify-by-decoration --pretty='format:%d' --since=2024-04-30 | sed '/^$/d' | cut -d ':' -f 2 | cut -d ')' -f 1 | tac | tr '\n' ' ')" >> $GITHUB_ENV
- name: Build docs
run: mkdocs build
run: |
for tag in ${{ env.TAGS }}; do
echo "### CHECKOUT TO ${tag} ###"
git checkout $tag
if [[ "$tag" == *"rc"* || "$tag" == *"dev"* || "$tag" == *"pre"* ]]; then
mike deploy $tag
else
mike deploy --update-aliases $tag latest
fi
done
- name: Create docs directory
run: sudo mkdir -p ${{ secrets.DOCS_DEPLOY_DIR }}
- name: Set latest version as default
run: mike set-default latest

- name: Move html files to docs directory
run: sudo mv site ${{ secrets.DOCS_DEPLOY_DIR }}/html-${{ github.ref_name}}
- name: Change branch to get html files
run: git checkout gh-pages

- name: Remove old folder
run: sudo rm -rf ${{ secrets.DOCS_DEPLOY_DIR }}/html

- name: Remove old symlink
run: sudo unlink ${{ secrets.DOCS_DEPLOY_DIR }}/html
- name: Create docs directory
run: sudo mkdir -p ${{ secrets.DOCS_DEPLOY_DIR }}/html

- name: Create new symlink
run: sudo ln -s ${{ secrets.DOCS_DEPLOY_DIR }}/html-${{ github.ref_name}} ${{ secrets.DOCS_DEPLOY_DIR }}/html
- name: Move html files to docs directory
run: sudo cp -r * ${{ secrets.DOCS_DEPLOY_DIR }}/html

- name: Restart web service
run: sudo systemctl restart nginx
154 changes: 0 additions & 154 deletions docs/mkdocs.yml

This file was deleted.

9 changes: 8 additions & 1 deletion docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{% extends "base.html" %}

{% block announce %}
Version 0.1.12 is <a href="https://github.com/GreenmaskIO/greenmask/releases/tag/v0.1.11">released</a>
Version 0.1.13 is <a href="https://github.com/GreenmaskIO/greenmask/releases/tag/v0.1.13">released</a>
{% endblock %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
12 changes: 12 additions & 0 deletions docs/release_notes/greenmask_0_1_13.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Greenmask 0.1.13

This release introduces only improvements in documentation deployment. The core greenmask utility does not contain any changes.

## Changes

* Added documentation deployment with versioning

## Assets

To download the Greenmask binary compatible with your system, see
the [release's assets list](https://github.com/GreenmaskIO/greenmask/releases/tag/v0.1.13).
8 changes: 5 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ nav:
- Core custom functions: built_in_transformers/advanced_transformers/custom_functions/core_functions.md
- Faker function: built_in_transformers/advanced_transformers/custom_functions/faker_function.md
- Release notes:
- Greenmask 0.1.13: release_notes/greenmask_0_1_13.md
- Greenmask 0.1.12: release_notes/greenmask_0_1_12.md
- Greenmask 0.1.11: release_notes/greenmask_0_1_11.md
- Greenmask 0.1.10: release_notes/greenmask_0_1_10.md
Expand All @@ -134,13 +135,13 @@ nav:

repo_url: https://github.com/GreenmaskIO/greenmask
repo_name: GreenmaskIO/greenmask
site_url: https://greenmask.io
site_url: https://greenmask.io/
copyright: Copyright &copy; 2024 Greenmask


extra:
# version:
# provider: mike
version:
provider: mike
social:
- icon: fontawesome/brands/x-twitter
link: https://twitter.com/GreenmaskIO
Expand All @@ -152,3 +153,4 @@ extra:
plugins:
- social
- search
- mike
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ tinycss2==1.2.1
urllib3==2.2.1
watchdog==4.0.0
webencodings==0.5.1
mike==2.1.1

0 comments on commit ef3e2e9

Please sign in to comment.