mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-30 08:37:20 +00:00
66 lines
2.4 KiB
YAML
66 lines
2.4 KiB
YAML
name: Sync docs with Readme
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "docs/pydoc/**"
|
|
push:
|
|
branches:
|
|
- main
|
|
# release branches have the form v1.9.x
|
|
- "v[0-9].*[0-9].x"
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout this repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python 3.8.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r docs/pydoc/requirements.txt
|
|
|
|
- name: Generate API docs
|
|
env:
|
|
# This is necessary to fetch the documentation categories
|
|
# from Readme.io as we need them to associate the slug
|
|
# in config files with their id.
|
|
README_API_KEY: ${{ secrets.README_API_KEY }}
|
|
run: ./.github/utils/pydoc-markdown.sh
|
|
|
|
- name: Get current version
|
|
id: current-version
|
|
if: github.event_name == 'push'
|
|
shell: bash
|
|
# We only need `major.minor` in Readme so we cut the full version string to the first two tokens
|
|
run: echo "minor=$(cut -d "." -f 1,2 < VERSION.txt)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Sync docs with unstable release
|
|
# Instead of putting more logic into the previous step, let's just assume that commits on `main`
|
|
# will always be synced to the current `X.Y-unstable` version on Readme
|
|
id: sync-main
|
|
if: github.ref_name == 'main' && github.event_name == 'push'
|
|
uses: readmeio/rdme@8.3.1
|
|
env:
|
|
README_API_KEY: ${{ secrets.README_API_KEY }}
|
|
with:
|
|
rdme: docs ./docs/pydoc/temp --key="$README_API_KEY" --version=${{ steps.current-version.outputs.minor }}-unstable
|
|
|
|
- name: Sync docs with current release
|
|
# Mutually exclusive with the previous one, this step is supposed to only run on version branches.
|
|
# Sync the current Haystack version `X.Y.Z` with its corresponding Readme version `X.Y`.
|
|
# See https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context for the condition used
|
|
if: steps.sync-main.outcome == 'skipped' && github.event_name == 'push'
|
|
uses: readmeio/rdme@8.3.1
|
|
env:
|
|
README_API_KEY: ${{ secrets.README_API_KEY }}
|
|
with:
|
|
rdme: docs ./docs/pydoc/temp --key="$README_API_KEY" --version=${{ steps.current-version.outputs.minor }}
|