deploy #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: "deploy" | |
on: | |
workflow_run: | |
workflows: | |
- build | |
types: | |
- 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 | |
steps: | |
- name: Update github page deployment | |
uses: actions/deploy-pages@v4 |