Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4

- uses: actions/configure-pages@v5
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'

- uses: astral-sh/setup-uv@v4
with:
Expand All @@ -48,19 +48,33 @@ jobs:
- name: Prepare package list
env:
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
mkdir -p .cache/package-index
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/main" ]; then
gh release download ddp-package-assets --pattern packages.json --dir .cache/package-index \
|| : > .cache/package-index/packages.json
PACKAGE_LIST=.cache/package-index/packages.json
if { [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; } \
&& [ "${{ github.ref }}" = "refs/heads/main" ]; then
ASSET_ID=$(gh api "repos/${GITHUB_REPOSITORY}/releases/tags/ddp-package-assets" \
--jq '.assets[] | select(.name == "packages.json") | .id' 2>/dev/null || true)
if [ -n "${ASSET_ID}" ]; then
gh api \
-H "Accept: application/octet-stream" \
"repos/${GITHUB_REPOSITORY}/releases/assets/${ASSET_ID}" > "${PACKAGE_LIST}"
echo "Downloaded package list from ddp-package-assets/packages.json"
else
: > "${PACKAGE_LIST}"
echo "No ddp-package-assets/packages.json asset found; building docs with an empty package list"
fi
else
: > .cache/package-index/packages.json
: > "${PACKAGE_LIST}"
echo "Building docs with an empty package list for non-deploy event"
fi
wc -c "${PACKAGE_LIST}"

- run: make docs PACKAGE_LIST=.cache/package-index/packages.json

- uses: actions/upload-pages-artifact@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
with:
path: site

Expand All @@ -72,7 +86,7 @@ jobs:
if-no-files-found: error

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment:
Expand Down
Loading