From fa8070056a8da67c573a4253c94868010844ce9a Mon Sep 17 00:00:00 2001 From: yats0x7 Date: Mon, 10 Aug 2026 20:14:54 +0530 Subject: [PATCH] fix: standardize docs preview build Signed-off-by: yats0x7 --- .github/workflows/build-docs-preview.yml | 54 ++++++++++-------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-docs-preview.yml b/.github/workflows/build-docs-preview.yml index 9aaebc5..1f28553 100644 --- a/.github/workflows/build-docs-preview.yml +++ b/.github/workflows/build-docs-preview.yml @@ -24,8 +24,6 @@ jobs: build-docs-preview: runs-on: ubuntu-24.04 if: github.event.action != 'closed' - # env: - # HUGO_VERSION: 0.158.0 steps: # Hugo Module fetching hits proxy.golang.org and sum.golang.org. Harmless under egress-policy: audit, but if the harden-runner is promoted to block, @@ -40,33 +38,6 @@ jobs: with: persist-credentials: false - # hugo-extended is one of the dependencies which gets added onto the node_modules whenever npm install is run, - # so the commented out code below serves as a second installation of hugo within the runner. - # the commented out code is to be removed if the pr preview builds successfully. - - # - name: Install Hugo CLI - # run: | - # wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ - # && sudo dpkg -i ${{ runner.temp }}/hugo.deb - - # - name: Install Dart Sass - # # Direct download from the dart-sass GitHub release rather than - # # `sudo snap install dart-sass` (snap.io's storeserver was flaky - # # in GitHub-hosted runners and broke this workflow on unrelated - # # PRs, see #19574). Hugo Extended ships embedded Dart Sass as of - # # v0.114+ but having the standalone binary on PATH is the most - # # reliable path through `resources.toCSS` with transpiler "dartsass". - # env: - # DART_SASS_VERSION: 1.79.5 - # run: | - # set -eu - # cd "${RUNNER_TEMP}" - # curl -fsSL -o dart-sass.tar.gz "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - # sudo tar -xzf dart-sass.tar.gz -C /usr/local/lib - # sudo ln -sf /usr/local/lib/dart-sass/sass /usr/local/bin/sass - # sudo ln -sf /usr/local/lib/dart-sass/sass /usr/local/bin/dart-sass - # dart-sass --version - - name: Setup Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: @@ -90,7 +61,7 @@ jobs: HUGO_PREVIEW: "true" DEPLOY_PRIME_URL: "/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/" run: | - npm run build:preview + make build-preview cat > public/robots.txt <<'ROBOTS' User-agent: * Disallow: / @@ -108,6 +79,25 @@ jobs: with: name: docs-preview-build path: | - ${{ github.event.action != 'closed' && 'public' || '' }} + public pr/ - if-no-files-found: error \ No newline at end of file + if-no-files-found: error + + save-closed-pr-metadata: + if: github.event.action == 'closed' + runs-on: ubuntu-24.04 + + steps: + - name: Save PR metadata + run: | + mkdir -p ./pr + echo "${{ github.event.number }}" > ./pr/number + echo "${{ github.event.pull_request.head.sha }}" > ./pr/sha + echo "${{ github.event.action }}" > ./pr/action + + - name: Upload PR metadata + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: docs-preview-build + path: pr/ + if-no-files-found: error