Skip to content

Commit 57e907b

Browse files
authored
Add "mike" support for versioned docs. (#49)
Add "mike" support for versioned docs. Add a CONTRIBUTING.md and a tag verification workflow. Signed-off-by: Dean Roehrich <dean.roehrich@hpe.com>
1 parent 1cd1707 commit 57e907b

8 files changed

Lines changed: 168 additions & 2 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish `main` Documentation
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build:
9+
name: Publish Development Documentation
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v3
21+
22+
- name: Install Dependencies
23+
run: |
24+
pip install --disable-pip-version-check -r mkdocs_requirements.txt
25+
26+
- name: Configure Git
27+
run: |
28+
git config --local user.name "Doc Deploy Bot"
29+
git config --local user.email "bot@noreply.github.hpe.com"
30+
31+
- name: mike Deploy Main
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
mike deploy --push dev

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Release Documentation
2+
on:
3+
release:
4+
types:
5+
- published
6+
7+
jobs:
8+
build:
9+
name: Publish Release Documentation
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v3
21+
22+
- name: Install Dependencies
23+
run: |
24+
pip install --disable-pip-version-check -r mkdocs_requirements.txt
25+
26+
- name: Configure Git
27+
run: |
28+
git config --local user.name "Doc Deploy Bot"
29+
git config --local user.email "bot@noreply.github.hpe.com"
30+
31+
- name: mike deploy new version
32+
env:
33+
VERSION: ${{ github.event.release.tag_name }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
mike deploy --push --update-aliases "$VERSION" "latest"
37+
mike set-default --push latest

.github/workflows/verify_tag.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Pushing a tag triggers this workflow, which verifies that it is an
2+
# annotated tag.
3+
name: Verify tag
4+
5+
on:
6+
push:
7+
tags:
8+
- "v*"
9+
10+
jobs:
11+
verify_tag:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: "Verify context"
15+
run: |
16+
echo "ref is ${{ github.ref }}"
17+
echo "ref_type is ${{ github.ref_type }}"
18+
19+
- uses: actions/checkout@v3
20+
# actions/checkout@v3 breaks annotated tags by converting them into
21+
# lightweight tags, so we need to force fetch the tag again
22+
# See: https://github.com/actions/checkout/issues/290
23+
- name: "Repair tag"
24+
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }}
25+
- name: "Verify tag is annotated"
26+
run: if test x$(git for-each-ref ${{ github.ref }} | awk '{print $2}') = xtag; then /bin/true; else echo "\"${{ github.ref }}\" does not look like an annotated tag!"; /bin/false; fi
27+
- name: "Echo release tag"
28+
run: echo "TAG=${{ github.repository }}:${{ github.ref }}"

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
We welcome contributions to NNF
2+
3+
# Pull Requests
4+
5+
This repository follows the standard GitHub fork+pull model. We accept GitHub pull requests.
6+
7+
Fork the project on GitHub, work in your fork and in branches, push these to your GitHub fork, and when ready, open up a GitHub pull request against `https://github.com/NearNodeFlash/NearNodeFlash.github.io`.
8+
9+
## Developer's Certificate of Origin
10+
11+
All contributions must include acceptance of the DCO:
12+
13+
> Developer Certificate of Origin Version 1.1
14+
>
15+
> Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660
16+
> York Street, Suite 102, San Francisco, CA 94110 USA
17+
>
18+
> Everyone is permitted to copy and distribute verbatim copies of this
19+
> license document, but changing it is not allowed.
20+
>
21+
> Developer's Certificate of Origin 1.1
22+
>
23+
> By making a contribution to this project, I certify that:
24+
>
25+
> \(a) The contribution was created in whole or in part by me and I have
26+
> the right to submit it under the open source license indicated in the
27+
> file; or
28+
>
29+
> \(b) The contribution is based upon previous work that, to the best of my
30+
> knowledge, is covered under an appropriate open source license and I
31+
> have the right under that license to submit that work with
32+
> modifications, whether created in whole or in part by me, under the same
33+
> open source license (unless I am permitted to submit under a different
34+
> license), as indicated in the file; or
35+
>
36+
> \(c) The contribution was provided directly to me by some other person
37+
> who certified (a), (b) or (c) and I have not modified it.
38+
>
39+
> \(d) I understand and agree that this project and the contribution are
40+
> public and that a record of the contribution (including all personal
41+
> information I submit with it, including my sign-off) is maintained
42+
> indefinitely and may be redistributed consistent with this project or
43+
> the open source license(s) involved.
44+
45+
### Sign Your Work
46+
47+
To accept the DCO, simply add this line to each commit message with your name and email address (`git commit -s` will do this for you):
48+
49+
Signed-off-by: Johnny Appleseed <johnny@appleseed.com>
50+
51+
For legal reasons, no anonymous or pseudonymous contributions are accepted.

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ site_description: 'Near Node Flash'
33
docs_dir: docs/
44
repo_name: GitHub
55
repo_url: https://github.com/NearNodeFlash/NearNodeFlash.github.io
6+
copyright: '&copy; Copyright 2023 Hewlett Packard Enterprise Development LP'
67
nav:
78
- Home: index.md
89
#- About: about.md
@@ -21,12 +22,17 @@ nav:
2122
- 'Rabbit Storage For Containerized Applications': 'rfcs/0002/readme.md'
2223
theme:
2324
name: 'material'
25+
custom_dir: overrides
2426
logo: img/logo.png
2527
favicon: img/logo.png
2628
plugins:
2729
- search
2830
- macros
2931
- section-index
32+
extra:
33+
version:
34+
provider: mike
35+
default: latest
3036
markdown_extensions:
3137
- toc:
3238
permalink: true

mkdocs_requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
mkdocs
2+
mike
23
-r requirements.txt
3-
mkdocs-material
4-
mkdocs-material-extensions

overrides/main.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "base.html" %}
2+
3+
{% block outdated %}
4+
You're not viewing the latest version.
5+
<a href="{{ '../' ~ base_url }}">
6+
<strong>Click here to go to latest.</strong>
7+
</a>
8+
{% endblock %}

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
mkdocs-section-index
22
mkdocs-macros-plugin
3+
mkdocs-material
4+
mkdocs-material-extensions

0 commit comments

Comments
 (0)