Skip to content

Commit 9961009

Browse files
authored
Build all sites on CI (#1514)
This gives earlier feedback than deploy previews for folks who can't push to the CodeYourFuture fork (because deploy previews require manual approval). It also adds a handy script for making sure all sites build.
1 parent 3c00957 commit 9961009

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/build-all-sites.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build all sites
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build_all_sites:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup Go
13+
uses: actions/setup-go@v4
14+
with:
15+
go-version: 1.21
16+
- name: Setup Hugo
17+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f
18+
with:
19+
hugo-version: '0.136.3'
20+
extended: true
21+
- name: Build all sites
22+
run: ./tooling/build_all_sites.sh
23+
env:
24+
HUGO_CURRICULUM_GITHUB_BEARER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

common-theme/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"start:dev": "dotenv -- hugo server -p 3000 -D",
9+
"build:dev": "hugo mod vendor && dotenv -e ../.env -- hugo --environment development",
910
"build:audit": "HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo mod vendor && dotenv -e ../.env -- hugo --environment production && grep -inorE '<\\!-- raw HTML omitted -->|ZgotmplZ|\\[i18n\\]|\\(<nil>\\)|(&lt;nil&gt;)|hahahugo' public/"
1011
},
1112
"repository": {

tooling/build_all_sites.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
6+
REPO_ROOT="$(cd "${SCRIPT_DIR}" && cd .. && pwd)"
7+
8+
for dir in $(find "${REPO_ROOT}" -type d -maxdepth 1 -not -name .git -not -name tooling); do
9+
if [[ ! -e "${dir}/package.json" ]]; then
10+
continue
11+
fi
12+
cd "${dir}"
13+
echo >&2 "Trying to build in ${dir}"
14+
npm install
15+
npm run build:dev || { echo >&2 "Failed to build in ${dir}"; exit 1; }
16+
done

0 commit comments

Comments
 (0)