-
Notifications
You must be signed in to change notification settings - Fork 22
99 lines (82 loc) · 3.32 KB
/
docusaurus_sync.yml
File metadata and controls
99 lines (82 loc) · 3.32 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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: deepset-ai/haystack
ref: main
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Download API reference artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
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.