-
Notifications
You must be signed in to change notification settings - Fork 9
67 lines (60 loc) · 2.09 KB
/
api_docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Sync docs with Readme
on:
pull_request:
paths:
- "docs/pydoc/**"
push:
branches:
- main
env:
HATCH_VERSION: "1.13.0"
PYTHON_VERSION: "3.10"
SYNC_LAST_N_HAYSTACK_VERSIONS: 1
jobs:
get-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.version_finder.outputs.versions }}
steps:
- name: Get Haystack Docs versions
id: version_finder
run: |
curl -s "https://dash.readme.com/api/v1/version" --header "authorization: Basic ${{ secrets.README_API_KEY }}" > out
VERSIONS=$(jq -c '[ .[] | select(.version | startswith("2.")) | .version ] | .[-${{ env.SYNC_LAST_N_HAYSTACK_VERSIONS }}:]' out)
{
echo 'versions<<EOF'
echo "$VERSIONS"
echo EOF
} >> "$GITHUB_OUTPUT"
sync:
runs-on: ubuntu-latest
needs: get-versions
strategy:
fail-fast: false
max-parallel: 1
matrix:
hs-docs-version: ${{ fromJSON(needs.get-versions.outputs.versions) }}
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- 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 }}
# The command is a bit misleading, we're not actually syncing anything here,
# we're just generating the markdown files from the the yaml configs.
PYDOC_TOOLS_HAYSTACK_DOC_VERSION: ${{ matrix.hs-docs-version }}
run: hatch run readme:sync
- name: Sync docs for ${{ matrix.hs-docs-version }}
if: github.event_name == 'push'
uses: readmeio/rdme@v8
with:
rdme: docs ./docs/pydoc/temp --key=${{ secrets.README_API_KEY }} --version=${{ matrix.hs-docs-version }}