Skip to content
Open
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
54 changes: 22 additions & 32 deletions .github/workflows/build-docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand All @@ -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: /
Expand All @@ -108,6 +79,25 @@ jobs:
with:
name: docs-preview-build
path: |
${{ github.event.action != 'closed' && 'public' || '' }}
public
pr/
if-no-files-found: error
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
Loading