Skip to content

Commit bfa9982

Browse files
authored
Merge pull request #8 from saxbophone/josh/7-multiversion-docs
Added simple implementation of versioned Doxygen docs. Close #7
2 parents f615c5c + a0d1a71 commit bfa9982

File tree

8 files changed

+60
-7
lines changed

8 files changed

+60
-7
lines changed

.github/workflows/build-release.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [published]
66

77
jobs:
8-
build:
8+
build-release:
99
runs-on: ${{ matrix.os }}
1010
env:
1111
BUILD_TYPE: Release
@@ -57,3 +57,33 @@ jobs:
5757
with:
5858
name: project_build_${{ github.run_number }}_${{ matrix.platform_name }}
5959
path: ${{github.workspace}}/artifacts
60+
build-docs:
61+
runs-on: ubuntu-20.04
62+
# don't deploy docs unless release build succeeds
63+
needs: build-release
64+
steps:
65+
- uses: actions/checkout@v2
66+
- name: Set Tag Name
67+
shell: bash
68+
# trim prefix from ref to get tag name
69+
run: echo "TAG_NAME=${GITHUB_REF#'refs/tags/'}" >> $GITHUB_ENV
70+
- name: Format Docs Version Name
71+
shell: bash
72+
# trim patch version off version number as minor version specifies ABI changes
73+
run: echo "DOCS_VERSION=${TAG_NAME%.*}" >> $GITHUB_ENV
74+
- name: Build Doxygen Docs
75+
uses: mattnotmitt/[email protected]
76+
- name: Set up latest docs auto-linking
77+
shell: bash
78+
working-directory: ${{github.workspace}}
79+
# make docs folder, move docs there, call script to generate HTML redirect in index
80+
run: |
81+
mkdir docs
82+
cp -R html docs/$DOCS_VERSION
83+
./generate_index $DOCS_VERSION
84+
- name: Deploy Docs to github-pages
85+
uses: JamesIves/[email protected]
86+
with:
87+
branch: gh-pages
88+
folder: docs
89+
clean: false

.github/workflows/continuous-integration.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ on:
88
types: [opened, synchronize]
99

1010
jobs:
11-
build:
11+
test-docs-build:
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Build Doxygen Docs
16+
uses: mattnotmitt/[email protected]
17+
18+
continuous-integration:
1219
runs-on: ${{ matrix.os }}
1320
env:
1421
BUILD_TYPE: Debug

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "C++20 Cross Platform Template"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER =
41+
PROJECT_NUMBER = $(TAG_NAME)
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

generate_index

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
# This script generates a tiny HTML file whose sole purpose is to
4+
# redirect to whichever folder the latest version of the docs is in
5+
#
6+
# This keeps things fairly simple, if a little clunky, as Github Pages
7+
# is a static site hosting service only (unless you're using Jekyll)
8+
# and Doxygen didn't support multi-version documentation sites at the
9+
# time of writing.
10+
11+
# pass version string for where the latest docs are as single parameter
12+
DOCS_VERSION=$1;
13+
# HTML template with DOCS_VERSION substituted
14+
HTML_FRAGMENT="<head><meta http-equiv='refresh' content='0; URL=${DOCS_VERSION}/'/></head><body><p>If you are not redirected in five seconds,<a href='${DOCS_VERSION}/'>click here</a>.</p></body>";
15+
# write out to the index HTML file that will appear at the root of Github Pages
16+
echo $HTML_FRAGMENT > "docs/index.html";

project/include/project/Public.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file
33
* This is a sample public compilation unit.
44
*
5-
* @author Your Name <your email address>
5+
* @author Your Name <your.email.address@goes.here>
66
* @date Creation/Edit Date
77
*
88
* @copyright Copyright information goes here

project/src/Private.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* This is a sample private compilation unit.
33
*
44
* <Copyright information goes here>

project/src/Private.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* This is a sample private compilation unit.
33
*
44
* <Copyright information goes here>

project/src/Public.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* This is a sample source file corresponding to a public header file.
33
*
44
* <Copyright information goes here>

0 commit comments

Comments
 (0)