@@ -59,24 +59,46 @@ runs:
5959 run : |
6060 make init
6161
62- # Download pre-built library docs from the latest GitHub Release
63- # The generate-library.yml workflow must have run at least once
62+ # Download pre-built library docs from draft release or latest published release
6463 - name : " Download Pre-built Library Docs"
6564 shell : bash
6665 env :
6766 GH_TOKEN : ${{ inputs.repo_access_token }}
6867 run : |
69- echo "Finding latest library-docs release..."
70- LATEST_TAG=$(gh release list --repo ${{ github.repository }} --limit 50 | grep "library-docs-" | head -1 | awk -F'\t' '{print $3}')
71- if [ -z "$LATEST_TAG" ]; then
72- echo "Error: No library-docs release found. Run the 'Generate Library' workflow first."
73- exit 1
68+ DOWNLOADED=false
69+
70+ # Try draft release first
71+ echo "Checking for draft release..."
72+ DRAFT_TAG=$(gh release list --repo ${{ github.repository }} --exclude-drafts=false --limit 20 | { grep "Draft" || true; } | head -1 | awk -F'\t' '{print $3}')
73+
74+ if [ -n "$DRAFT_TAG" ]; then
75+ echo "Found draft release: ${DRAFT_TAG}"
76+ if gh release download "${DRAFT_TAG}" \
77+ --repo ${{ github.repository }} \
78+ --pattern "library-docs.tar.gz" \
79+ --dir /tmp 2>/dev/null; then
80+ echo "Downloaded library docs from draft release"
81+ DOWNLOADED=true
82+ else
83+ echo "Draft release exists but has no library-docs.tar.gz asset"
84+ fi
85+ else
86+ echo "No draft release found"
7487 fi
75- echo "Downloading from release: ${LATEST_TAG}"
76- gh release download "${LATEST_TAG}" \
77- --repo ${{ github.repository }} \
78- --pattern "library-docs.tar.gz" \
79- --dir /tmp
88+
89+ # Fall back to latest published release
90+ if [ "$DOWNLOADED" = false ]; then
91+ echo "Downloading from latest published release..."
92+ if ! gh release download \
93+ --repo ${{ github.repository }} \
94+ --pattern "library-docs.tar.gz" \
95+ --dir /tmp; then
96+ echo "Error: No library-docs.tar.gz found in any release. Run the 'Generate Library' workflow first."
97+ exit 1
98+ fi
99+ echo "Downloaded library docs from latest published release"
100+ fi
101+
80102 echo "Extracting library docs..."
81103 tar -xzf /tmp/library-docs.tar.gz
82104 echo "Library docs downloaded and extracted successfully"
0 commit comments