Minor enhancements #10
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: Generate and publish API documentation | |
on: | |
push: | |
branches: | |
- 'master' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: code | |
- name: Install required packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends doxygen graphviz | |
- name: Run Doxygen | |
run: | | |
cd code/docs | |
doxygen | |
- uses: actions/checkout@v2 | |
with: | |
repository: bibletime/api_docs | |
path: api_docs | |
token: ${{ secrets.PAT }} | |
- name: Configure API documentation repository checkout, clear local copy | |
working-directory: api_docs | |
run: | | |
git config --worktree user.name 'GitHub workflow' | |
git config --worktree user.email 'invalid@invalid' | |
git checkout --orphan updated | |
git rm -rf --cached --ignore-unmatch . | |
git rm -rf --ignore-unmatch . | |
git clean -dffx | |
- name: Move generated API documentation to repository | |
run: | | |
mv -f code/docs/doxygen/html api_docs/docs | |
- name: Commit and push the generated documentation | |
working-directory: api_docs | |
run: | | |
EMPTY="" | |
git add docs | |
cat << EOF > commitMessage | |
Automatic update for ${GITHUB_REF} | |
$EMPTY | |
GITHUB_REPOSITORY: ${GITHUB_REPOSITORY} | |
GITHUB_REF: ${GITHUB_REF} | |
GITHUB_SHA: ${GITHUB_SHA} | |
GITHUB_ACTOR: ${GITHUB_ACTOR} | |
$EMPTY | |
GITHUB_RUN_ID: ${GITHUB_RUN_ID} | |
GITHUB_RUN_NUMBER: ${GITHUB_RUN_NUMBER} | |
GITHUB_ACTION: ${GITHUB_ACTION} | |
EOF | |
git commit -F commitMessage | |
git push --force origin HEAD:master |