feat: add support for google gemini with genai sdk #73
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: Deploy Documentation | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' # Documentation content | |
- 'mkdocs.yml' # MkDocs configuration | |
- '.github/workflows/docs.yml' # This workflow file | |
- 'pyproject.toml' # For doc dependencies | |
# Add any Python files that generate docs | |
- 'prompt_templates/**/*.py' # Source files (for docstrings) | |
# Optional: Allow manual triggers | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
check_changes: | |
runs-on: ubuntu-latest | |
outputs: | |
should_deploy: ${{ steps.check.outputs.should_deploy }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for checking changes | |
- name: Check for documentation changes | |
id: check | |
run: | | |
# Check if this is a manual trigger | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo "should_deploy=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
# For push events, check if this is the first push | |
if [ -z "${{ github.event.before }}" ]; then | |
echo "should_deploy=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
# Check for changes in relevant files | |
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > changed_files.txt | |
# Debug output | |
echo "Changed files:" | |
cat changed_files.txt | |
# Look for changes in docs, mkdocs.yml, or Python files | |
if grep -q -E '^docs/|^mkdocs\.yml|\.py$' changed_files.txt; then | |
echo "should_deploy=true" >> $GITHUB_OUTPUT | |
else | |
echo "should_deploy=false" >> $GITHUB_OUTPUT | |
fi | |
deploy: | |
if: > | |
github.event_name == 'workflow_dispatch' || | |
(needs.check_changes.outputs.should_deploy == 'true' && github.event_name == 'push') | |
runs-on: ubuntu-latest | |
needs: check_changes # Still need this for push events | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Git Credentials | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
# Debug: Show poetry version | |
poetry --version | |
# Install with verbose output | |
poetry install --only docs -v | |
# List all installed packages | |
poetry run pip list | |
# Show poetry environment info | |
poetry env info | |
- name: Build and deploy documentation | |
run: | | |
# Configure git to use the new repository URL | |
git remote set-url origin https://github.com/MoritzLaurer/prompt_templates.git | |
poetry run mkdocs gh-deploy --force |