Merge pull request #117 from vintasoftware/fix/gitignore-docs-build #3
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: Publish Documentation | |
on: | |
push: | |
branches: | |
- main | |
- docs-update | |
tags: | |
- '**' | |
env: | |
COLUMNS: 150 | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: checkout current branch | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Check docs build | |
run: | | |
poetry run mkdocs build | |
- name: Run tests | |
run: | | |
poetry run pytest | |
env: | |
OPENAI_API_KEY: "sk-fake-test-key-123" | |
- name: Set git credentials | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- run: poetry run mike deploy -b gh-pages dev --push | |
if: "github.ref == 'refs/heads/main'" | |
- if: "github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/')" | |
id: check-version | |
uses: samuelcolvin/[email protected] | |
with: | |
version_file_path: 'django_ai_assistant/__init__.py' | |
skip_env_check: true | |
- run: poetry run mike deploy -b gh-pages ${{ steps.check-version.outputs.VERSION_MAJOR_MINOR }} latest --update-aliases --push | |
if: "(github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/')) && !fromJSON(steps.check-version.outputs.IS_PRERELEASE)" |