diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index 0eee066..b1dd693 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -70,6 +70,36 @@ jobs: CONTAINER_ENGINE: docker CONFIG_OVERRIDES: _config-overrides.yml BUILD_IMAGE_SPEC: localhost:5000/kroxy-jekyll:latest + - name: Warn about future-dated posts + run: | + today=$(date -u +%Y-%m-%d) + future_posts=() + for post in _posts/*.md; do + filename=$(basename "$post") + file_date=$(echo "$filename" | grep -oP '^\d{4}-\d{2}-\d{2}') + # Extract the full front matter date value (may include time and timezone offset) + # and convert to a UTC date so that e.g. "2026-03-05 00:00:00 +1300" is + # correctly treated as 2026-03-04 in UTC (matching Jekyll's behaviour). + front_matter_raw=$(grep -oP '^date:\s*\K.+' "$post" | xargs 2>/dev/null || true) + if [[ -n "$front_matter_raw" ]]; then + post_date=$(date -u -d "$front_matter_raw" +%Y-%m-%d 2>/dev/null || echo "$file_date") + else + post_date="$file_date" + fi + if [[ -n "$post_date" && "$post_date" > "$today" ]]; then + future_posts+=("$filename (publishes $post_date)") + fi + done + if [[ ${#future_posts[@]} -gt 0 ]]; then + echo "## ⚠️ Future-dated posts detected" >> "$GITHUB_STEP_SUMMARY" + echo "The following posts will not appear until the site is rebuilt on or after their publish date:" >> "$GITHUB_STEP_SUMMARY" + for post in "${future_posts[@]}"; do + echo "- $post" >> "$GITHUB_STEP_SUMMARY" + done + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "Re-run this workflow manually on the publish date to make them live." >> "$GITHUB_STEP_SUMMARY" + fi + - name: Upload artifact # Automatically uploads an artifact from the './_site' directory by default uses: actions/upload-pages-artifact@v3 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index b655f5c..0c4225a 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -39,6 +39,27 @@ jobs: CONTAINER_ENGINE: docker BUILD_IMAGE_SPEC: localhost:5000/kroxy-jekyll:latest + - name: Require post front matter date is not older than filename date + run: | + mismatches=() + for post in _posts/*.md; do + filename=$(basename "$post") + file_date=$(echo "$filename" | grep -oP '^\d{4}-\d{2}-\d{2}') + front_matter_date=$(grep -oP '^date:\s*\K\d{4}-\d{2}-\d{2}' "$post" || true) + if [[ -n "$file_date" && -n "$front_matter_date" && "$front_matter_date" < "$file_date" ]]; then + mismatches+=("$filename: filename date=$file_date, front matter date=$front_matter_date") + fi + done + if [[ ${#mismatches[@]} -gt 0 ]]; then + echo "Error: post front matter date is older than filename date:" >&2 + for mismatch in "${mismatches[@]}"; do + echo " $mismatch" >&2 + done + exit 1 + else + echo "Success: all post front matter dates are consistent with filename dates" + fi + # Currently the image shas are not available when we create the release, they need to be manually # updated in the release PR before merge. - name: Require release manifests to contain non-placeholder container image SHAs diff --git a/_posts/2024-04-10-release-0_5_1.md b/_posts/2024-04-10-release-0_5_1.md index 137687c..e0e667b 100644 --- a/_posts/2024-04-10-release-0_5_1.md +++ b/_posts/2024-04-10-release-0_5_1.md @@ -1,7 +1,7 @@ --- layout: post title: "Kroxylicious release 0.5.1" -date: 2024-04-09 20:00:00 +0000 +date: 2024-04-10 20:00:00 +0000 author: "Sam Barker" author_url: "https://www.github.com/sambarker" categories: [releases, kroxylicious, record-encryption]