Add documentation version switcher #16
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
UPA_DEPLOY: ${{ github.ref == 'refs/heads/main' }} | |
UPA_DOCS_REPOSITORY: url-upa/docs | |
UPA_DOCS_DIR: main | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download theme | |
run: doc/download-theme.sh | |
- uses: mattnotmitt/doxygen-action@edge | |
- name: Is there a gh-pages branch? | |
if: env.UPA_DEPLOY | |
run: echo "UPA_CHECKOUT=$(git ls-remote --heads https://github.com/$UPA_DOCS_REPOSITORY.git refs/heads/gh-pages)" >> "$GITHUB_ENV" | |
- name: Checkout ${{ env.UPA_DOCS_REPOSITORY }} | |
uses: actions/checkout@v4 | |
if: env.UPA_DEPLOY && env.UPA_CHECKOUT | |
with: | |
repository: ${{ env.UPA_DOCS_REPOSITORY }} | |
ref: gh-pages | |
path: build-docs | |
- name: Prepare directory for publication | |
if: env.UPA_DEPLOY | |
run: | | |
mkdir -p build-docs | |
rm -rf build-docs/.git | |
rm -rf build-docs/common | |
rm -rf build-docs/${{ env.UPA_DOCS_DIR }} | |
cp -r doc/common build-docs/common | |
mv doc/html build-docs/${{ env.UPA_DOCS_DIR }} | |
cp doc/index.html build-docs | |
- name: Deploy to ${{ env.UPA_DOCS_REPOSITORY }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: env.UPA_DEPLOY | |
with: | |
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
repository-name: ${{ env.UPA_DOCS_REPOSITORY }} | |
folder: build-docs |