Handle release/* branch names in CI/CD process #214
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
name: Documentation Update | |
on: | |
push: { branches: [ master ] } | |
jobs: | |
ghp: | |
name: GitHub Pages | |
if: github.repository_owner == 'pencil2d' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Pencil2D source code | |
uses: actions/checkout@v2 | |
- name: Check out the documentation repository | |
uses: actions/checkout@v2 | |
with: | |
repository: pencil2d/pencil-docs | |
token: ${{secrets.docs_repo_token}} | |
path: gh-pages | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -yq | |
sudo apt-get install -yq --no-install-suggests --no-install-recommends graphviz fonts-open-sans xsltproc | |
curl -fsSLO https://www.doxygen.nl/files/doxygen-1.9.6.linux.bin.tar.gz | |
tar xf doxygen-1.9.6.linux.bin.tar.gz | |
realpath doxygen-1.9.6/bin >> "${GITHUB_PATH}" | |
- name: Retrieve Qt tagfiles | |
working-directory: util/docs | |
run: | | |
for i in core gui network svg testlib widgets xml; do | |
curl -fsSLO "https://doc.qt.io/qt-5/qt${i}.tags" | |
done | |
- name: Generate documentation | |
run: | | |
echo PROJECT_NUMBER=${{github.sha}} >> Doxyfile | |
echo LAYOUT_FILE=util/docs/layout.xml >> Doxyfile | |
echo HTML_HEADER=util/docs/header.html >> Doxyfile | |
echo HTML_FOOTER=util/docs/footer.html >> Doxyfile | |
echo HTML_EXTRA_STYLESHEET=util/docs/extra.css >> Doxyfile | |
echo HAVE_DOT=YES >> Doxyfile | |
echo DOT_COMMON_ATTR=\"fontname=\\\"Open Sans\\\",fontsize=13.2\" >> Doxyfile | |
echo DOT_EDGE_ATTR=\"labelfontname=\\\"Open Sans\\\",labelfontsize=13.2\" >> Doxyfile | |
doxygen 2>&1 | tee doxygen.log | |
if [ ! -f "docs/html/index.html" ]; then | |
echo "::error::Documentation output was not found" | |
exit 1 | |
fi | |
xsltproc --novalid -o docs/html/404.html util/docs/404.xsl docs/html/index.html | |
# Doxygen's search results positioning code is buggy and doesn't consider scrollbars | |
sed -i 's/left -= domPopupSearchResults.offsetWidth;/left -= domPopupSearchResults.offsetWidth - domPopupSearchResultsWindow.clientWidth - parseFloat(getComputedStyle(domPopupSearchResultsWindow).borderLeftWidth) - parseFloat(getComputedStyle(domPopupSearchResultsWindow).borderRightWidth) + domPopupSearchResultsWindow.offsetWidth;/' docs/html/search/search.js | |
- name: Remove old documentation | |
run: | | |
mv gh-pages/docs/CNAME docs/html/ | |
rm -rf gh-pages/docs/ | |
- name: Push updated documentation | |
working-directory: gh-pages | |
run: | | |
mv ../doxygen.log . | |
mv ../docs/html docs | |
git add --all | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git commit -m "Add generated docs for rev ${{github.repository}}@${{github.sha}}" -m "Generated in Actions run #${{github.run_number}}" | |
git push |