Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up versioning #32

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: '0' # checkout all commits to get the actual page revision time

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Cache social plugin files
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
Expand All @@ -32,7 +32,10 @@ jobs:
- name: Install Python dependencies
run: pip install -r docs/requirements.txt

- name: Deploy MkDocs application
- name: Deploy MkDocs application with mike
env:
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
run: mkdocs gh-deploy --force
run: |
git config user.name ci-bot
git config user.email [email protected]
mike deploy --push devel
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Social plugin files
.cache/

# mike files
site/
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@ Website for my notes on various programming-related topics.
### Command Line

1. `mkdocs serve`

## Versioning

1. Pull requests to main are deployed to `rolling`: `mike deploy --push rolling`
2. Releases are deployed to `<x.x>`, which is aliased to `latest`: `mike deploy --push --update-aliases <x.x> latest`
- Set this as default version: `mike set-default --push latest`
- Only have to do this once as setting alias as default then updating alias
3. Consider deploying pull requests to `<branch-name>`: `mike deploy --push devel-<branch-name>`
- Would have to delete on pull request to main: `mike delete --push devel-<branch-name>`
6 changes: 2 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cairosvg
mike
mkdocs-git-revision-date-localized-plugin==1.*
mkdocs-material==9.*

# social plugin dependencies

cairosvg
pillow
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edit_uri: ""
# Configuration
theme:
name: material
custom_dir: overrides
features:
- content.code.annotate
- navigation.expand
Expand Down
8 changes: 8 additions & 0 deletions overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}