@@ -18,6 +18,9 @@ inputs:
1818 repo_access_token :
1919 description : " GitHub Token used to access private repos"
2020 required : true
21+ skip_library_download :
22+ description : " Skip downloading library docs from release (use when docs are already present)"
23+ default : " false"
2124
2225runs :
2326 using : composite
@@ -59,44 +62,42 @@ runs:
5962 run : |
6063 make init
6164
62- # Download pre-built library docs from draft release or latest published release
65+ # Download pre-built library docs from the most recent release (draft or published) that has the asset
6366 - name : " Download Pre-built Library Docs"
67+ if : ${{ inputs.skip_library_download != 'true' }}
6468 shell : bash
6569 env :
6670 GH_TOKEN : ${{ inputs.repo_access_token }}
6771 run : |
6872 DOWNLOADED=false
6973
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}')
74+ # Get all releases (drafts and published) ordered by most recent first
75+ echo "Searching for library-docs.tar.gz in releases ..."
76+ RELEASES =$(gh release list --repo ${{ github.repository }} --exclude-drafts=false --limit 20 | awk -F'\t' '{print $3}')
7377
74- if [ -n "$DRAFT_TAG" ]; then
75- echo "Found draft release: ${DRAFT_TAG}"
76- if gh release download "${DRAFT_TAG}" \
78+ if [ -z "$RELEASES" ]; then
79+ echo "Error: No releases found. Run the 'Generate Library' workflow first."
80+ exit 1
81+ fi
82+
83+ # Iterate through releases until we find one with library-docs.tar.gz
84+ for TAG in $RELEASES; do
85+ echo "Checking release: ${TAG}"
86+ if gh release download "${TAG}" \
7787 --repo ${{ github.repository }} \
7888 --pattern "library-docs.tar.gz" \
7989 --dir /tmp 2>/dev/null; then
80- echo "Downloaded library docs from draft release"
90+ echo "Downloaded library docs from release: ${TAG} "
8191 DOWNLOADED=true
92+ break
8293 else
83- echo "Draft release exists but has no library-docs.tar.gz asset "
94+ echo " No library-docs.tar.gz in ${TAG}, trying next... "
8495 fi
85- else
86- echo "No draft release found"
87- fi
96+ done
8897
89- # Fall back to latest published release
9098 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"
99+ echo "Error: No library-docs.tar.gz found in any release. Run the 'Generate Library' workflow first."
100+ exit 1
100101 fi
101102
102103 echo "Extracting library docs..."
0 commit comments