Skip to content

Commit 2ee83f2

Browse files
committed
2 parents b696a49 + 4903145 commit 2ee83f2

7 files changed

Lines changed: 96 additions & 74 deletions

File tree

.claude/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(node -e ':*)",
5+
"Read(//c/Projekte/XE/recipe/{split\\($1, a, \"M\"\\); total=a[1]; print \"Total in dist/**)",
6+
"Read(//c/Projekte/XE/recipe/{split\\($1, a, \"M\"\\); images=a[1]; print \"Total in dist/img/**)",
7+
"Bash(gh run:*)",
8+
"Bash(gh api:*)",
9+
"Bash(node -e \"const d=require\\('fs'\\).readFileSync\\('/dev/stdin','utf8'\\); const j=JSON.parse\\(d\\); console.log\\('source:', JSON.stringify\\(j.source\\)\\); console.log\\('build_type:', j.build_type\\); console.log\\('cname:', j.cname\\);\")",
10+
"Bash(node -p \"JSON.parse\\(require\\('fs'\\).readFileSync\\(0,'utf8'\\)\\).tree.map\\(t=>t.path\\).join\\('\\\\n'\\)\")"
11+
]
12+
}
13+
}

.github/workflows/jekyll-gh-pages.yml

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ on:
1111

1212
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1313
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
14+
contents: write
1715

1816
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1917
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
@@ -23,72 +21,55 @@ concurrency:
2321

2422
env:
2523
NODE_VERSION: "22"
24+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2625

2726
jobs:
28-
# Build job
29-
build:
27+
build-deploy:
3028
runs-on: ubuntu-latest
3129
steps:
3230
- name: Checkout
3331
uses: actions/checkout@v4
34-
32+
3533
- name: Setup Node.js
3634
uses: actions/setup-node@v4
3735
with:
3836
node-version: ${{ env.NODE_VERSION }}
3937
cache: 'npm'
40-
41-
- name: Cache Eleventy build artifacts
38+
39+
- name: Cache Eleventy incremental build state
4240
uses: actions/cache@v4
4341
with:
44-
path: |
45-
dist
46-
.cache
47-
_site
48-
key: eleventy-build-${{ runner.os }}-${{ hashFiles('src/**/*', 'content/**/*', 'media/**/*', 'eleventy.config.js', 'postcss.config.js', 'package-lock.json') }}
42+
path: .cache
43+
key: eleventy-build-${{ runner.os }}-${{ hashFiles('eleventy.config.js', 'package-lock.json') }}-${{ github.sha }}
4944
restore-keys: |
50-
eleventy-build-${{ runner.os }}-${{ hashFiles('eleventy.config.js', 'postcss.config.js', 'package-lock.json') }}
51-
45+
eleventy-build-${{ runner.os }}-${{ hashFiles('eleventy.config.js', 'package-lock.json') }}-
46+
5247
- name: Cache processed images
5348
uses: actions/cache@v4
5449
with:
55-
path: |
56-
dist/img
57-
.cache/img
58-
key: eleventy-img-${{ runner.os }}-${{ hashFiles('media/**/*', 'src/_11ty/shortcodes.js') }}
50+
path: dist/img
51+
key: eleventy-img-${{ runner.os }}-${{ hashFiles('src/_11ty/shortcodes.js') }}-${{ github.sha }}
5952
restore-keys: |
60-
eleventy-img-${{ runner.os }}-${{ hashFiles('media/**/*') }}
61-
53+
eleventy-img-${{ runner.os }}-${{ hashFiles('src/_11ty/shortcodes.js') }}-
54+
6255
- name: Cache CSS build
6356
uses: actions/cache@v4
6457
with:
6558
path: dist/styles
66-
key: css-build-${{ runner.os }}-${{ hashFiles('src/site.css', 'src/_styles/**/*', 'postcss.config.js') }}
59+
key: css-build-${{ runner.os }}-${{ hashFiles('postcss.config.js') }}-${{ github.sha }}
6760
restore-keys: |
68-
css-build-${{ runner.os }}-${{ hashFiles('postcss.config.js') }}
69-
61+
css-build-${{ runner.os }}-${{ hashFiles('postcss.config.js') }}-
62+
7063
- name: Install dependencies
7164
run: npm ci
72-
65+
7366
- name: Build site
7467
run: npm run build
75-
76-
- name: Setup Pages
77-
uses: actions/configure-pages@v5
78-
79-
- name: Upload artifact
80-
uses: actions/upload-pages-artifact@v4
81-
with:
82-
path: ./dist
8368

84-
# Deployment job
85-
deploy:
86-
environment:
87-
name: github-pages
88-
url: ${{ steps.deployment.outputs.page_url }}
89-
runs-on: ubuntu-latest
90-
needs: build
91-
steps:
9269
- name: Deploy to GitHub Pages
93-
id: deployment
94-
uses: actions/deploy-pages@v4
70+
uses: peaceiris/actions-gh-pages@v4
71+
with:
72+
github_token: ${{ secrets.GITHUB_TOKEN }}
73+
publish_dir: ./dist
74+
force_orphan: true
75+
cname: recipe.polente.de

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
temp-dist
66
.ftp-deploy-sync-state.json
77
.claude/settings.local.json
8+
.claude/settings.json

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recipe.polente.de

eleventy.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = function (eleventyConfig) {
5454
});
5555
eleventyConfig.addPassthroughCopy({ "src/static/robots.txt": "/robots.txt" });
5656
eleventyConfig.addPassthroughCopy({ "src/static/google354922043c8d9d58.html": "/google354922043c8d9d58.html" });
57+
eleventyConfig.addPassthroughCopy({ "CNAME": "/CNAME" });
5758

5859
// Watch targets
5960
eleventyConfig.addWatchTarget("./src/_styles/**/*.css");

package-lock.json

Lines changed: 34 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/_11ty/shortcodes.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
const Image = require("@11ty/eleventy-img");
2+
const fs = require("fs");
3+
4+
const imageOptions = {
5+
widths: [320, 640, 960, 1280, 1600],
6+
formats: ["avif", "webp"],
7+
urlPath: "/img/",
8+
outputDir: "./dist/img/",
9+
sharpAvifOptions: {
10+
quality: 50,
11+
},
12+
sharpWebpOptions: {
13+
quality: 65,
14+
},
15+
};
216

317
const picture = async function (
418
src,
@@ -8,18 +22,14 @@ const picture = async function (
822
sizes = "(min-width: 64rem) 1024px, 100vw",
923
fetchpriority = undefined
1024
) {
11-
const metadata = await Image(src, {
12-
widths: [320, 640, 960, 1280, 1600],
13-
formats: ["avif", "webp"],
14-
urlPath: "/img/",
15-
outputDir: "./dist/img/",
16-
sharpAvifOptions: {
17-
quality: 50,
18-
},
19-
sharpWebpOptions: {
20-
quality: 65,
21-
},
22-
});
25+
// Use statsSync to compute expected output filenames without processing
26+
const stats = Image.statsSync(src, imageOptions);
27+
const allExist = Object.values(stats)
28+
.flat()
29+
.every((s) => fs.existsSync(`${imageOptions.outputDir}${s.filename}`));
30+
31+
// Skip expensive Sharp processing if all output files already exist (e.g. from CI cache)
32+
const metadata = allExist ? stats : await Image(src, imageOptions);
2333

2434
const imageAttributes = {
2535
title,

0 commit comments

Comments
 (0)