ci: Fix changelog generation (#1199) #388
Workflow file for this run
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: Core / Sync docs with Readme | |
on: | |
push: | |
tags: | |
- "**-v[0-9].[0-9]+.[0-9]+" | |
workflow_dispatch: # Activate this workflow manually | |
inputs: | |
tag: | |
description: "Tag with this format: integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0" | |
required: true | |
type: string | |
default: integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0 | |
env: | |
TAG: ${{ inputs.tag || github.ref_name }} | |
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 '[ .[] | select(.version | startswith("2."))| .version ]' 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: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U haystack-pydoc-tools hatch | |
- name: Get project folder | |
id: pathfinder | |
shell: python | |
run: | | |
import os | |
project_path = os.environ["TAG"].rsplit("-", maxsplit=1)[0] | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
print(f'project_path={project_path}', file=f) | |
- name: Generate docs | |
working-directory: ${{ steps.pathfinder.outputs.project_path }} | |
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 same category has a different id on different readme docs versions. | |
# This is the docs version on readme that we'll use to get the category id. | |
PYDOC_TOOLS_HAYSTACK_DOC_VERSION: ${{ matrix.hs-docs-version }} | |
run: | | |
hatch run docs | |
mkdir tmp | |
find . -name "_readme_*.md" -exec cp "{}" tmp \; | |
ls tmp | |
- name: Sync API docs with Haystack docs version ${{ matrix.hs-docs-version }} | |
uses: readmeio/rdme@v8 | |
with: | |
rdme: docs ${{ steps.pathfinder.outputs.project_path }}/tmp --key=${{ secrets.README_API_KEY }} --version=${{ matrix.hs-docs-version }} |