From d45cd74f2e26e3abfcf22c219c03f73efe6a963c Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Thu, 12 Dec 2024 10:41:08 -0600 Subject: [PATCH] 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: 2d64c496 (feat(cicd): automated builds and deployment to pages, 2024-11-19) Signed-off-by: Randolph Sapp --- .github/workflows/build.yml | 18 ------------- .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c3e59445..77d4886fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 467c8db1b..12bbe1181 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 + + + + + PSDK Documentation Landing Page + + +
+

PSDK Documentation Landing Page

+
    + 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 '
  • %s
  • \n' \ + "$relative_path" "$text" >> build/index.html + fi + done + + cat << EOF >> build/index.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