Skip to content

Website

Website #234

Workflow file for this run

name: Website
# Builds the static site from the result files of one Benchmarks run and publishes it to GitHub Pages.
# Benchmarks dispatches this workflow with its run id; a push that changes the site uses the latest completed run.
on:
push:
branches: [main]
paths:
- 'site/**'
- '.github/workflows/website.yml'
workflow_dispatch:
inputs:
benchmark_run_id:
description: Benchmarks run whose results to publish (empty = latest completed run)
required: false
type: string
default: ''
permissions:
contents: read
concurrency:
group: keyload-website
cancel-in-progress: false
jobs:
build:
name: Generate website
if: github.repository == 'managedcode/KeyLoad' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions: {contents: read, actions: read}
env:
GH_TOKEN: ${{ github.token }}
REQUESTED_RUN: ${{ inputs.benchmark_run_id }}
steps:
- name: Download source code
uses: actions/checkout@v7
- name: Choose the Benchmarks run
id: run
run: |
run_id="$REQUESTED_RUN"
if [[ -z "$run_id" ]]; then
run_id=$(gh run list --repo "$GITHUB_REPOSITORY" --workflow benchmarks.yml --branch main --status completed \
--limit 1 --json databaseId --jq '.[0].databaseId')
fi
[[ "$run_id" =~ ^[1-9][0-9]*$ ]]
printf 'id=%s\n' "$run_id" >> "$GITHUB_OUTPUT"
printf 'Publishing results of Benchmarks run %s\n' "$run_id" >> "$GITHUB_STEP_SUMMARY"
- name: Download the benchmark results
run: gh run download "${{ steps.run.outputs.id }}" --repo "$GITHUB_REPOSITORY" --pattern 'benchmark-*' --dir results
- name: Merge the results
run: node site/scripts/results.mjs --input=results --output=site-results/results.json
- name: Build the site
run: node site/scripts/build.mjs --results=site-results/results.json --output=_site --site-revision="$GITHUB_SHA"
- name: Upload the site for GitHub Pages
uses: actions/upload-pages-artifact@v5
with:
path: _site
include-hidden-files: true
deploy:
name: Publish website
needs: [build]
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions: {pages: write, id-token: write}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure GitHub Pages
uses: actions/configure-pages@v6
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5