Skip to content

Commit 628cb3c

Browse files
committed
ci: purge stale Pages artifacts
1 parent f464f7f commit 628cb3c

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ jobs:
4040
- name: "Create Hugo module directories for Docsy"
4141
run: node themes/docsy/tools/mkdirp-hugo-mod.js themes
4242

43+
- name: "Validate"
44+
run: npm test
45+
4346
- name: "Build"
44-
run: hugo --gc --minify --destination docs
47+
run: hugo --gc --minify --cleanDestinationDir --destination docs
4548

4649
- name: "Deploy"
4750
uses: peaceiris/actions-gh-pages@v4

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ dev-all:
2020

2121
# Production build
2222
build:
23-
HUGO_ENV="production" ./scripts/hugo.sh --gc --minify
23+
HUGO_ENV="production" ./scripts/hugo.sh --gc --minify --cleanDestinationDir
2424

2525
# Validate all pages without changing generated site files
2626
check:
27-
node --test scripts/homepage-reveal.test.mjs
27+
node --test scripts/*.test.mjs
2828
HUGO_ENV="production" HUGO_READ_ONLY=1 ./scripts/hugo.sh --gc --minify --renderToMemory --noBuildLock
2929

3030
# Clean build artifacts

scripts/site-build.test.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import assert from 'node:assert/strict';
2+
import { readFile } from 'node:fs/promises';
3+
import test from 'node:test';
4+
5+
const makefile = await readFile(new URL('../Makefile', import.meta.url), 'utf8');
6+
const workflow = await readFile(new URL('../.github/workflows/deploy.yml', import.meta.url), 'utf8');
7+
8+
test('production builds remove stale generated pages', () => {
9+
assert.match(makefile, /^build:\n\t.*--cleanDestinationDir/m);
10+
assert.match(workflow, /name: "Build"[\s\S]*?run: hugo .*--cleanDestinationDir/);
11+
});
12+
13+
test('Pages deployment runs the project validation suite', () => {
14+
assert.match(workflow, /name: "Validate"\n\s+run: npm test/);
15+
});

0 commit comments

Comments
 (0)