Skip to content

Commit 993e4f4

Browse files
StaticRocketcshilwant
authored andcommitted
ci(deploy): move aggregation step into deploy
The workflows for working with pages artifacts are not as smart as the standard artifact routines. As such, the aggregation of previous artifacts must take place in the deploy script so the final artifact generated will have the same run-id as the deploy step that fetches it. Fixes: 2d64c49 (feat(cicd): automated builds and deployment to pages, 2024-11-19) Signed-off-by: Randolph Sapp <[email protected]>
1 parent 0ad5542 commit 993e4f4

File tree

2 files changed

+51
-18
lines changed

2 files changed

+51
-18
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,3 @@ jobs:
6767
name: ${{ matrix.device }}-${{ matrix.os }}
6868
path: build/
6969
retention-days: 1
70-
71-
agregate:
72-
name: Agregate build artifacts
73-
runs-on: ubuntu-latest
74-
needs: build
75-
76-
steps:
77-
- name: Download all artifacts
78-
uses: actions/download-artifact@v4
79-
with:
80-
github-token: ${{ secrets.GITHUB_TOKEN }}
81-
path: build
82-
merge-multiple: true
83-
84-
- name: Upload static files as single artifact
85-
uses: actions/upload-pages-artifact@v3
86-
with:
87-
path: build

.github/workflows/deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,60 @@ on:
99
- completed
1010

1111
jobs:
12+
agregate:
13+
name: Agregate build artifacts
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Download all artifacts
18+
uses: actions/download-artifact@v4
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
path: build
22+
merge-multiple: true
23+
run-id: ${{ github.event.workflow_run.id }}
24+
25+
- name: Generate root index
26+
run: |
27+
cat << EOF > build/index.html
28+
<!DOCTYPE html>
29+
<html lang="en">
30+
<head>
31+
<meta charset="utf-8">
32+
<title>PSDK Documentation Landing Page</title>
33+
</head>
34+
<body>
35+
<main>
36+
<h1>PSDK Documentation Landing Page</h1>
37+
<ul>
38+
EOF
39+
40+
for path in build/*/; do
41+
root_index=$(find "$path" -name index.html | sort -u | tail -1)
42+
if [ -n "$root_index" ]; then
43+
text=$(basename "$path")
44+
relative_path=$(realpath "$root_index" --relative-to=build)
45+
printf ' <li><a href="%s">%s</a></li>\n' \
46+
"$relative_path" "$text" >> build/index.html
47+
fi
48+
done
49+
50+
cat << EOF >> build/index.html
51+
</ul>
52+
</main>
53+
</body>
54+
</html>
55+
EOF
56+
57+
- name: Upload static files as single artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: build
61+
1262
deploy:
1363
name: Deploy
1464
runs-on: ubuntu-latest
65+
needs: agregate
1566
permissions:
1667
pages: write
1768
id-token: write

0 commit comments

Comments
 (0)