name: Deploy Documentation on: push: branches: - main paths: - 'docs/**' - 'mkdocs.yml' release: types: - published workflow_dispatch: permissions: contents: write jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: 3.x - run: pip install mkdocs-material mike - name: Configure git user run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Deploy docs (push to main) if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: | PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version --quiet -DforceStdout) if [[ "${PROJECT_VERSION}" == *-SNAPSHOT ]]; then ALIAS="latest-snapshot" else ALIAS="latest" fi mike deploy --push --update-aliases "${PROJECT_VERSION}" "${ALIAS}" mike set-default latest --push - name: Deploy versioned docs (release) if: github.event_name == 'release' run: | VERSION=${GITHUB_REF_NAME} mike deploy --push --update-aliases "${VERSION}" latest mike set-default latest --push