haystack/.github/workflows/readme_sync.yml
dependabot[bot] c78eb9be4e
build(deps): bump readmeio/rdme from 8 to 9 (#8615)
Bumps [readmeio/rdme](https://github.com/readmeio/rdme) from 8 to 9.
- [Release notes](https://github.com/readmeio/rdme/releases)
- [Changelog](https://github.com/readmeio/rdme/blob/next/CHANGELOG.md)
- [Commits](https://github.com/readmeio/rdme/compare/v8...v9)

---
updated-dependencies:
- dependency-name: readmeio/rdme
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-10 13:22:08 +01:00

66 lines
2.0 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"
# Exclude 1.x release branches, there's another workflow handling those
- "!v1.[0-9]+.x"
env:
HATCH_VERSION: "1.13.0"
PYTHON_VERSION: "3.10"
jobs:
sync:
runs-on: ubuntu-latest
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 yaml configs.
run: hatch run readme:sync
- name: Get version
id: version-getter
run: |
VERSION="$(hatch version | cut -d '.' -f 1,2)"
CURRENT_BRANCH="${{ github.ref_name }}"
# If we're on `main` branch we should push docs to the unstable version
if [ "$CURRENT_BRANCH" = "main" ]; then
VERSION="$VERSION-unstable"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Sync docs
if: github.event_name == 'push'
uses: readmeio/rdme@v9
with:
rdme: docs ./docs/pydoc/temp --key=${{ secrets.README_API_KEY }} --version=${{ steps.version-getter.outputs.version }}
- name: Delete outdated
if: github.event_name == 'push'
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
run: hatch run readme:delete-outdated --version="${{ steps.version-getter.outputs.version }}" --config-path ./docs/pydoc/config