-
Notifications
You must be signed in to change notification settings - Fork 22
100 lines (83 loc) · 3.04 KB
/
docusaurus_sync.yml
File metadata and controls
100 lines (83 loc) · 3.04 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Sync API reference with Docusaurus
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
# Manual trigger: Use this ONLY if the automatic API reference sync failed during a release.
# This will regenerate and sync the API reference to the Haystack repository.
# WARNING: Running this workflow when this repository has evolved significantly since the release
# will sync an incorrect API reference to Haystack.
workflow_dispatch:
env:
HATCH_VERSION: "1.16.5"
PYTHON_VERSION: "3.11"
jobs:
generate-api-reference:
runs-on: ubuntu-slim
steps:
- name: Checkout this repo
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Generate API reference
run: hatch run docs
- name: Upload API reference artifact
uses: actions/upload-artifact@v7
with:
name: experimental-api-reference
path: tmp_api_reference
if-no-files-found: error
retention-days: 1
overwrite: true
sync-api-reference:
runs-on: ubuntu-slim
needs: generate-api-reference
steps:
- name: Checkout Haystack repo
uses: actions/checkout@v6
with:
repository: deepset-ai/haystack
ref: main
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Download API reference artifact
uses: actions/download-artifact@v8
with:
name: experimental-api-reference
path: tmp_api_reference
- name: Sync API reference
run: |
# Function to sync generated API reference to a destination
sync_to_dest() {
echo "Syncing to $1"
mkdir -p "$1"
rsync -av --delete --exclude='.git/' "tmp_api_reference/" "$1/"
}
# Sync to main reference
sync_to_dest "docs-website/reference/experiments-api"
# Sync to all versioned directories
if [ -d "docs-website/reference_versioned_docs" ]; then
for version_dir in "docs-website/reference_versioned_docs"/version-*; do
[ -d "$version_dir" ] && sync_to_dest "$version_dir/experiments-api"
done
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
commit-message: "Sync Haystack Experimental API reference on Docusaurus"
branch: sync-docusaurus-api-reference-experimental
base: main
title: "docs: sync Haystack Experimental API reference on Docusaurus"
add-paths: |
docs-website
body: |
This PR syncs the Haystack Experimental API reference on Docusaurus. Just approve and merge it.
reviewers: "${{ github.actor }}"