Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(deploy): move aggregation step into deploy #109

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,3 @@ jobs:
name: ${{ matrix.device }}-${{ matrix.os }}
path: build/
retention-days: 1

agregate:
name: Agregate build artifacts
runs-on: ubuntu-latest
needs: build

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path: build
merge-multiple: true

- name: Upload static files as single artifact
uses: actions/upload-pages-artifact@v3
with:
path: build
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,60 @@ on:
- completed

jobs:
agregate:
name: Agregate build artifacts
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path: build
merge-multiple: true
run-id: ${{ github.event.workflow_run.id }}

- name: Generate root index
run: |
cat << EOF > build/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PSDK Documentation Landing Page</title>
</head>
<body>
<main>
<h1>PSDK Documentation Landing Page</h1>
<ul>
EOF

for path in build/*/; do
root_index=$(find "$path" -name index.html | sort -u | tail -1)
if [ -n "$root_index" ]; then
text=$(basename "$path")
relative_path=$(realpath "$root_index" --relative-to=build)
printf ' <li><a href="%s">%s</a></li>\n' \
"$relative_path" "$text" >> build/index.html
fi
done

cat << EOF >> build/index.html
</ul>
</main>
</body>
</html>
EOF

- name: Upload static files as single artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: agregate
permissions:
pages: write
id-token: write
Expand Down
Loading