-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3d67a52
commit d6f571a
Showing
6 changed files
with
86 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,23 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- run: pip install pdoc | ||
python-version: '3.10' | ||
- run: pip install pydoctor==22.9.1 | ||
- name: build dev build | ||
if: inputs.version == '' | ||
run: pdoc --template-directory ./docs/pdoc_template -o pdocs --footer-text "idnumbers $(cat ./VERSION)+, dev version included" idnumbers | ||
run: | | ||
pydoctor --make-html --html-output=pydocs/dev --project-name="idnumbers" --project-version=dev --project-url=https://github.com/identique/idnumbers --template-dir=./docs/template idnumbers | ||
echo "window._CURRENT_VERSION = 'dev';" > pydocs/dev/current_version.js | ||
- name: build prod build | ||
if: inputs.version != '' | ||
run: pdoc --template-directory ./docs/pdoc_template -o pdocs --footer-text "idnumbers ${{ inputs.version }}" idnumbers | ||
run: | | ||
pydoctor --make-html --html-output=pydocs/v${{ inputs.version }} --project-name="idnumbers" --project-version=${{ inputs.version }} --project-url=https://github.com/identique/idnumbers --template-dir=./docs/template idnumbers | ||
echo "window._CURRENT_VERSION = '${{ inputs.version }}';" > pydocs/dev/current_version.js | ||
- run: cp docs/template/versions.js pydocs/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: apidoc | ||
path: pdocs | ||
path: pydocs | ||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
@@ -50,21 +55,22 @@ jobs: | |
- uses: actions/download-artifact@v3 | ||
with: | ||
name: apidoc | ||
path: pdocs | ||
path: pydocs | ||
- run: git config --local user.email "[email protected]" | ||
- run: git config --local user.name "Microdata Bot" | ||
- name: deploy dev apidoc | ||
if: inputs.version == '' | ||
run: | | ||
ls pdocs | ||
cp -rf pdocs/* ./docs | ||
ls pydocs | ||
cp -rf pydocs/* ./docs | ||
git add ./docs | ||
git diff-index --quiet HEAD || git commit -m "Update dev doc" | ||
- name: deploy prod apidoc | ||
if: inputs.version != '' | ||
run: | | ||
ls pdocs | ||
cp -rf pdocs ./docs/v${{ inputs.version }} | ||
ls pydocs | ||
cp -rf pydocs ./docs/v${{ inputs.version }} | ||
cp pydocs/versions.json ./docs/versions.json | ||
git add ./docs | ||
git diff-index --quiet HEAD || git commit -m "Add release doc v${{ inputs.version }}" | ||
- run: git push origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<head xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"> | ||
<meta name="pydoctor-template-version" content="2" /> | ||
<script type="text/javascript" src="current_version.js"/> | ||
<script type="text/javascript" src="../versions.js"/> | ||
<script type="text/javascript"> | ||
window.addEventListener("load", function init() { | ||
// change the container style | ||
const container = document.getElementById("search-box-container").parentNode; | ||
// version text | ||
const textSpan = document.createElement("span"); | ||
textSpan.textContent = "Versions:"; | ||
textSpan.style.paddingRight = "12px"; | ||
|
||
// use div as a group for version dropdown | ||
const div = document.createElement("div"); | ||
div.style.alignSelf = "center"; | ||
div.style.paddingLeft = "12px"; | ||
div.classList.add("input-group"); | ||
// create the select dropdown | ||
const select = document.createElement("select"); | ||
select.classList.add("form-control"); | ||
select.araLabel= "version dropdown"; | ||
select.title = "version dropdown"; | ||
select.style.display = "inline-block"; | ||
select.style.width = "90px"; | ||
select.style.float = "none"; | ||
// dev is always there | ||
const devOption = document.createElement("option"); | ||
devOption.value = "dev"; | ||
devOption.textContent = "Dev" | ||
devOption.selected = window._CURRENT_VERSION === "dev"; | ||
select.appendChild(devOption); | ||
(window._VERSIONS || []).forEach(function(version) { | ||
const verOption = document.createElement("option"); | ||
verOption.value = version; | ||
verOption.textContent = version; | ||
verOption.selected = window._CURRENT_VERSION === version; | ||
select.appendChild(verOption); | ||
}); | ||
select.addEventListener("change", function handleChange(evt) { | ||
const version = evt.target.value; | ||
window.location = `../v${version}/`; | ||
}); | ||
// put all of them | ||
div.appendChild(textSpan); | ||
div.appendChild(select); | ||
container.insertBefore(div, document.getElementById("search-box-container")); | ||
}); | ||
</script> | ||
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
window._VERSIONS = []; | ||
window._VERSIONS.push('1.0.0'); | ||
window._VERSIONS.push('1.1.0'); | ||
window._VERSIONS.push('1.2.0'); | ||
window._VERSIONS.push('1.3.0'); | ||
window._VERSIONS.push('1.4.0'); | ||
window._VERSIONS.push('1.5.0'); | ||
window._VERSIONS.push('1.6.0'); | ||
window._VERSIONS.push('1.7.0'); | ||
window._VERSIONS.push('1.8.0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters