diff --git a/.github/workflows/publish-apt.yml b/.github/workflows/publish-apt.yml index d021fbf..0633446 100644 --- a/.github/workflows/publish-apt.yml +++ b/.github/workflows/publish-apt.yml @@ -124,15 +124,62 @@ jobs: # Must run before publish-repo.sh, which generates every index.html at the # end by walking the staged tree. Staging the logs afterwards (as a # separate job did) leaves log/ absent from the root listing. + # + # Each run gets its own /log/-/ directory so previous runs + # are kept instead of being overwritten by the next publish. + id: stage run: | mkdir -p "$RUNNER_TEMP/repo" - ./scripts/collect-logs.sh "$RUNNER_TEMP/logs" "$RUNNER_TEMP/repo" + # github.run_started_at is an ISO-8601 UTC timestamp for every trigger. + run_dir="$(./scripts/log-run-dir.sh "${{ github.run_started_at }}" "${{ github.run_id }}")" + echo "Build log directory: /log/$run_dir/" + ./scripts/collect-logs.sh "$RUNNER_TEMP/logs" "$RUNNER_TEMP/repo" "$run_dir" + echo "run_dir=$run_dir" >> "$GITHUB_OUTPUT" - name: Generate and sign repository metadata env: APT_GPG_PASSPHRASE: ${{ secrets.APT_GPG_PASSPHRASE }} run: ./scripts/publish-repo.sh "$RUNNER_TEMP/packages" "$RUNNER_TEMP/repo" "$APT_GPG_KEY_ID" + - name: Collect the run directories already in the bucket + # Each run archives into /log/-/. The staged tree only knows + # about the current run, so the existing run directories are listed from + # R2 and passed on, otherwise /log/ would only ever list the newest run. + id: runs + env: + AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + AWS_REGION: auto + R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} + R2_BUCKET: ${{ secrets.R2_BUCKET }} + run: | + : "${AWS_ACCESS_KEY_ID:?AWS_ACCESS_KEY_ID is required}" + : "${AWS_SECRET_ACCESS_KEY:?AWS_SECRET_ACCESS_KEY is required}" + : "${R2_ACCOUNT_ID:?R2_ACCOUNT_ID is required}" + : "${R2_BUCKET:?R2_BUCKET is required}" + endpoint="https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com" + + # Delimiter-based listing returns the run directories, not every log + # object, so the list stays small however many logs accumulate. + mapfile -t existing < <( + aws s3api list-objects-v2 \ + --bucket "$R2_BUCKET" --prefix 'log/' --delimiter '/' \ + --endpoint-url "$endpoint" --region auto \ + --query 'CommonPrefixes[].Prefix' --output text 2>/dev/null \ + | tr '\t' '\n' | sed -n 's|^log/\([^/]*\)/$|\1|p' | grep -v '^$' || true + ) + + run_dir="${{ steps.stage.outputs.run_dir }}" + printf '%s\n' "current=$run_dir" >&2 + printf ' existing: %s\n' "${existing[*]:-none}" >&2 + + # Union of what is already published and this run, deduplicated. + printf '%s\n' "${existing[@]}" "$run_dir" \ + | grep -v '^$' | sort -u > "$RUNNER_TEMP/run-dirs.txt" + echo "run_dirs<> "$GITHUB_OUTPUT" + cat "$RUNNER_TEMP/run-dirs.txt" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + - name: Sync the repository to Cloudflare R2 env: AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} @@ -152,7 +199,7 @@ jobs: # served as application/octet-stream and download instead of render. aws s3 sync "$RUNNER_TEMP/repo" "s3://${R2_BUCKET}" \ --endpoint-url "$endpoint" --region auto --no-progress \ - --exclude '*index.html' --exclude 'log/*.log' + --exclude '*index.html' --exclude 'log/**' # Upload the generated directory indexes separately so they get an # explicit MIME type; browsers then render them instead of downloading @@ -164,10 +211,26 @@ jobs: --cache-control 'no-cache, max-age=60' # Build logs, plain text, uncached so a re-publish shows up immediately. - aws s3 sync "$RUNNER_TEMP/repo" "s3://${R2_BUCKET}" \ + # The source root is log/ itself rather than a repo-wide include: a + # repo-wide 'log/**' include would also match log//index.html and + # overwrite the text/html type the pass above just set. No --delete, so + # the directories of previous runs are kept. + if [[ -d "$RUNNER_TEMP/repo/log" ]]; then + aws s3 sync "$RUNNER_TEMP/repo/log" "s3://${R2_BUCKET}/log" \ + --endpoint-url "$endpoint" --region auto --no-progress \ + --exclude '*index.html' \ + --content-type 'text/plain; charset=utf-8' \ + --cache-control 'no-cache, max-age=60' + fi + + # Rebuild /log/index.html from every run directory in the bucket, so the + # listing points at archive directories instead of the current run's + # files and keeps every older run visible. + readarray -t run_dirs <<< "${{ steps.runs.outputs.run_dirs }}" + ./scripts/stage-log-index.sh "$RUNNER_TEMP/logindex" "${run_dirs[@]}" + aws s3 sync "$RUNNER_TEMP/logindex" "s3://${R2_BUCKET}/log" \ --endpoint-url "$endpoint" --region auto --no-progress \ - --exclude '*' --include 'log/*.log' \ - --content-type 'text/plain; charset=utf-8' \ + --content-type 'text/html; charset=utf-8' \ --cache-control 'no-cache, max-age=60' echo "Repository published to $APT_REPO_URL" diff --git a/.github/workflows/script-checks.yml b/.github/workflows/script-checks.yml index f54e6f1..b6b94ae 100644 --- a/.github/workflows/script-checks.yml +++ b/.github/workflows/script-checks.yml @@ -42,6 +42,41 @@ jobs: ! ./scripts/log-file-name.sh https://example.com/a/b 2>/dev/null ! ./scripts/log-file-name.sh https://github.com/onlyowner 2>/dev/null + - name: Test the run directory derivation + run: | + test "$(./scripts/log-run-dir.sh 2026-12-01T11:50:08Z 46640252167)" = \ + "2026-12-01-46640252167" + test "$(./scripts/log-run-dir.sh 2026-12-01T11:50:08+08:00 42)" = \ + "2026-12-01-42" + ! ./scripts/log-run-dir.sh not-a-date 42 2>/dev/null + # The run id becomes a path component, so anything but digits is out. + ! ./scripts/log-run-dir.sh 2026-12-01T11:50:08Z ../../etc 2>/dev/null + + - name: Test the archived log layout + # Logs must land in log/-/, be listed from /log/ and stay + # reachable, and older run directories must remain in the /log/ index. + run: | + tmp="$(mktemp -d)" + mkdir -p "$tmp/logs" "$tmp/repo" + printf 'run a\n' > "$tmp/logs/zitzhen-patchsplit.log" + + ./scripts/collect-logs.sh "$tmp/logs" "$tmp/repo" 2026-12-01-46640252167 + test -f "$tmp/repo/log/2026-12-01-46640252167/zitzhen-patchsplit.log" + # A malformed run directory must be rejected, not nested somewhere else. + ! ./scripts/collect-logs.sh "$tmp/logs" "$tmp/repo" ../escape 2>/dev/null + ! ./scripts/collect-logs.sh "$tmp/logs" "$tmp/repo" "" 2>/dev/null + + ./scripts/generate-index.sh "$tmp/repo" "test" + grep -q 'href="log/"' "$tmp/repo/index.html" + grep -q '2026-12-01-46640252167/' "$tmp/repo/log/index.html" + grep -q 'zitzhen-patchsplit.log' "$tmp/repo/log/2026-12-01-46640252167/index.html" + + # The /log/ index rebuilt from the bucket must list past runs too. + ./scripts/stage-log-index.sh "$tmp/logindex" \ + 2026-11-29-46000000000 2026-12-01-46640252167 + grep -q '2026-11-29-46000000000/' "$tmp/logindex/index.html" + grep -q '2026-12-01-46640252167/' "$tmp/logindex/index.html" + - name: Test build-deb.sh exit statuses # A cleanup trap that ends on a failing test used to turn successful # builds into exit 1, which skipped publish on every run. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0143a62..c7aede4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -129,12 +129,22 @@ argument, a log path, and mirrors the whole build into it: ./scripts/build-deb.sh https://github.com/zitzhen/patchsplit /tmp/debs /tmp/logs/patchsplit.log ``` -The publish workflow collects those logs with `scripts/collect-logs.sh` into the -staged `/log/` directory, so they appear at -`https://apt-general.zitzhen.cn/log/-.log`. That step runs even when -a build fails, which is why the log is worth writing: it is the artifact that -explains a broken package after the Actions run has expired. Treat logs as -public content — never echo secrets, tokens, or credentials into a build. +The publish workflow collects those logs with `scripts/collect-logs.sh` into a +per-run directory, so they are published at +`https://apt-general.zitzhen.cn/log/-/-.log` (for +example `/log/2026-12-01-46640252167/zitzhen-patchsplit.log`). The directory name +comes from `scripts/log-run-dir.sh`, and each run keeps its own copy rather than +overwriting the previous one. + +That step runs even when a build fails, which is why the log is worth writing: it +is the artifact that explains a broken package after the Actions run has expired. +Treat logs as public content — never echo secrets, tokens, or credentials into a +build. + +`scripts/stage-log-index.sh` rebuilds the `/log/` listing from every run +directory present in the bucket, so older runs stay browsable after a new publish +adds another directory. The sync never passes `--delete`; pruning old runs is a +manual decision, so do not assume logs disappear on their own. `scripts/publish-repo.sh` also calls `scripts/generate-index.sh`, which walks the staged tree and writes one `index.html` per directory. It only needs Bash and the diff --git a/README-zh-cn.md b/README-zh-cn.md index 348ee11..75b19b6 100644 --- a/README-zh-cn.md +++ b/README-zh-cn.md @@ -33,7 +33,8 @@ GitHub 仓库地址。手动触发的 GitHub Actions 工作流会: (详见[构建日志](#构建日志)); 7. 通过 `aws s3 sync` 把仓库同步到 Cloudflare R2 供 `apt` 拉取。其中 `index.html` 会单独上传并带上 `text/html` MIME 类型,日志带上 `text/plain`,两者都使用较短的 - `max-age`,确保浏览器渲染而不是直接下载,同时目录内容保持较新。 + `max-age`,确保浏览器渲染而不是直接下载,同时目录内容保持较新。构建日志按 + `log/<日期>-/` 归档,不会被自动清理。 ## 仓库布局 @@ -45,8 +46,10 @@ ZGS/ │ ├── diff-software-list.sh # 计算相对某个基线新增的仓库 │ ├── build-deb.sh # 从上游仓库构建 amd64 .deb │ ├── publish-repo.sh # 组装、签名并导出 apt 元数据 -│ ├── collect-logs.sh # 把构建日志收进待发布的 /log/ 目录 +│ ├── collect-logs.sh # 把构建日志收进 /log/<运行目录>/ │ ├── log-file-name.sh # 由仓库 URL 推导发布用的日志文件名 +│ ├── log-run-dir.sh # 推导单次运行的归档目录名 +│ ├── stage-log-index.sh # 汇总所有运行目录重建 /log/ 索引 │ ├── generate-index.sh # 为仓库目录树生成可浏览的 index.html │ └── test-workflow-build-step.sh # 在 bash 下执行 workflow 的 run 块 ├── .github/workflows/ # 构建检查与发布 CI @@ -100,23 +103,31 @@ sudo apt-get install -y git devscripts equivs dpkg-dev gnupg apt-utils ## 构建日志 -每个包的构建过程都会完整写入日志,以纯文本形式发布在 `/log/` 下: +每次发布都会把各包的构建日志归档到独立目录,因此历史构建记录不会被覆盖: ``` -https://apt-general.zitzhen.cn/log/ -https://apt-general.zitzhen.cn/log/zitzhen-patchsplit.log +https://apt-general.zitzhen.cn/log/ # 所有运行 +https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/ # 单次运行 +https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/zitzhen-patchsplit.log ``` -- 文件名规则为 `-.log`,由 `Software.list` 中的 URL 推导 +- 运行目录名为 `<日期>-`(如 `2026-12-01-46640252167`),由工作流的开始日期 + 与数字运行 ID 通过 `scripts/log-run-dir.sh` 推导。每次运行都有独立目录,不会覆盖 + 上一次。 +- 目录内的文件名规则为 `-.log`,由 `Software.list` 中的 URL 推导 (`https://github.com/zitzhen/patchsplit` → `zitzhen-patchsplit.log`)。 - 日志开头记录上游地址、开始时间、runner 与 commit,结尾记录结束时间与构建退出码, - 因此构建失败时无需打开 Actions 页面即可定位原因。 + 因此构建失败时无需打开 Actions 页面即可定位原因;其中的 `run` 行可直接跳回对应 + 的运行记录。 - `scripts/build-deb.sh` 的第三个参数是可选的日志路径;不传则不写日志,行为与之前 完全一致。 - 日志在 `publish-repo.sh` 生成索引**之前**就被放进仓库目录树,因此 `log/` 会和 `dists/`、`pool/` 一起出现在 的根目录列表里。 - 若在索引生成之后才放日志,`log/` 虽然能用 URL 直接访问,却不会出现在列表中。 -- 日志在每次发布时覆盖,并以 `Cache-Control: no-cache` 提供。 +- `/log/` 的列表页按 bucket 中实际存在的运行目录重建,因此历史运行同样可以浏览。 + 重建使用带 delimiter 的 `list-objects-v2`,即使运行次数很多,开销依然很小。 +- 同步**不使用** `--delete`,所以归档新日志不会删除旧日志;清理需要手动决定。 +- 日志是公开内容,并以 `Cache-Control: no-cache` 提供。切勿让构建把密钥、令牌等 + 敏感信息打进日志——工作流只会发布构建自己写出的内容。 ## 添加软件 diff --git a/README.md b/README.md index c774424..6b2d4d1 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ directory. A manually triggered GitHub Actions workflow: 7. Syncs the repository to Cloudflare R2 via `aws s3 sync` for `apt` to fetch. The `index.html` files are uploaded separately with a `text/html` content type, the logs with `text/plain`, and both with a short `max-age`, so - browsers render them instead of downloading them. + browsers render them instead of downloading them. Build logs are archived + per run under `log/-/` and are never pruned automatically. ## Repository layout @@ -56,8 +57,10 @@ ZGS/ │ ├── diff-software-list.sh # Computes repositories newly added since a base revision │ ├── build-deb.sh # Builds an amd64 .deb from an upstream repository │ ├── publish-repo.sh # Assembles, signs, and exports the apt metadata -│ ├── collect-logs.sh # Copies build logs into the staged /log/ directory +│ ├── collect-logs.sh # Copies build logs into /log// in the tree │ ├── log-file-name.sh # Derives the published log name from a repo URL +│ ├── log-run-dir.sh # Derives the per-run archive directory name +│ ├── stage-log-index.sh # Rebuilds /log/ from all run directories │ ├── generate-index.sh # Writes browsable index.html files for the tree │ └── test-workflow-build-step.sh # Runs a workflow run: block under bash ├── .github/workflows/ # Build-check and publish CI @@ -113,30 +116,39 @@ sudo apt-get install -y git devscripts equivs dpkg-dev gnupg apt-utils ## Build logs -Every package build writes its complete output to a log file, published in -plain text under `/log/`: +Every publish run archives the build log of each package into its own directory, +so past runs are kept instead of being overwritten: ``` -https://apt-general.zitzhen.cn/log/ -https://apt-general.zitzhen.cn/log/zitzhen-patchsplit.log +https://apt-general.zitzhen.cn/log/ # every run +https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/ # one run +https://apt-general.zitzhen.cn/log/2026-12-01-46640252167/zitzhen-patchsplit.log ``` -- The file name is `-.log`, derived from the `Software.list` URL - (`https://github.com/zitzhen/patchsplit` → `zitzhen-patchsplit.log`). +- The run directory is `-` (`2026-12-01-46640252167`), built from + the workflow's start date and its numeric run id by + `scripts/log-run-dir.sh`. Each run therefore gets a fresh directory and + nothing from an earlier run is replaced. +- Inside a run directory the file name is `-.log`, derived from the + `Software.list` URL (`https://github.com/zitzhen/patchsplit` → + `zitzhen-patchsplit.log`). - Each log starts with the upstream URL, start time, runner and commit, and ends with the finish time and the build's exit status, so a failed build is - diagnosable without opening the Actions run. + diagnosable without opening the Actions run. The `run` line links straight + back to the workflow run that produced it. - `scripts/build-deb.sh` takes an optional third argument for the log path. When it is omitted, nothing is written; the build behaves exactly as before. - The logs are staged into the repository tree before `publish-repo.sh` generates the indexes, so `log/` appears in the root listing at - alongside `dists/` and `pool/`. Staging them - after the index was generated left `log/` reachable by URL but missing from the - listing. -- Logs are overwritten on every publish run and are served with - `Cache-Control: no-cache`. -- Logs are public. Never let a build print secrets (tokens, credentials) into - them; the workflow only publishes what the build itself wrote. + alongside `dists/` and `pool/`. +- The `/log/` listing is rebuilt from the run directories that actually exist in + the bucket, so older runs stay browsable. It is done with a delimiter-based + `list-objects-v2`, which keeps the listing cheap however many runs accumulate. +- Nothing is deleted from `/log/`: the sync runs without `--delete`, so + archiving a new run never removes an old one. Pruning is a manual decision. +- Logs are public and served with `Cache-Control: no-cache`. Never let a build + print secrets (tokens, credentials) into them; the workflow only publishes + what the build itself wrote. ## Adding software diff --git a/scripts/collect-logs.sh b/scripts/collect-logs.sh index 1270d63..bd5c4ba 100755 --- a/scripts/collect-logs.sh +++ b/scripts/collect-logs.sh @@ -1,30 +1,45 @@ #!/usr/bin/env bash # Copy collected build logs into the staged repository tree so that they are -# published under /log/ alongside the packages and get a browsable index. +# published under /log// alongside the packages and get a browsable +# index. Each workflow run gets its own directory, so older runs are kept. set -euo pipefail -if [[ $# -ne 2 ]]; then - echo "Usage: collect-logs.sh " >&2 +if [[ $# -lt 2 || $# -gt 3 ]]; then + echo "Usage: collect-logs.sh [run-dir]" >&2 + echo " run-dir per-run directory under log/, e.g. 2026-12-01-46640252167" >&2 + echo " defaults to 'latest' so local invocations still work" >&2 exit 1 fi logs_dir="$1" publish_root="$2" +if [[ $# -eq 3 ]]; then + run_dir="$3" +else + run_dir="latest" +fi if [[ ! -d "$publish_root" ]]; then echo "Error: publish root not found: $publish_root" >&2 exit 1 fi +# run_dir becomes a path component under log/, so it must be a single safe name. +if [[ ! "$run_dir" =~ ^[A-Za-z0-9._-]+$ || "$run_dir" == "." || "$run_dir" == ".." ]]; then + echo "Error: invalid run directory name: $run_dir" >&2 + exit 1 +fi + +target_dir="$publish_root/log/$run_dir" + # Building can fail for individual packages; that is a warning here, not an # error, so a partially populated log directory still gets published. if [[ ! -d "$logs_dir" ]]; then - echo "Warning: no build logs found at $logs_dir; publishing an empty /log/" >&2 - mkdir -p "$publish_root/log" + echo "Warning: no build logs found at $logs_dir; publishing an empty /log/$run_dir/" >&2 + mkdir -p "$target_dir" exit 0 fi -target_dir="$publish_root/log" mkdir -p "$target_dir" shopt -s nullglob @@ -32,14 +47,14 @@ logs=("$logs_dir"/*.log "$logs_dir"/*/*.log) shopt -u nullglob if (( ${#logs[@]} == 0 )); then - echo "Warning: no .log files under $logs_dir; publishing an empty /log/" >&2 + echo "Warning: no .log files under $logs_dir; publishing an empty /log/$run_dir/" >&2 exit 0 fi for log in "${logs[@]}"; do name="$(basename -- "$log")" # Names are derived from the upstream URL by the workflow; keep them flat and - # safe so a malformed name cannot escape /log/. + # safe so a malformed name cannot escape the run directory. name="${name//[^A-Za-z0-9._-]/_}" case "$name" in .|..|'') echo "Warning: skipping unusable log name for $log" >&2; continue ;; diff --git a/scripts/log-run-dir.sh b/scripts/log-run-dir.sh new file mode 100755 index 0000000..1100eb4 --- /dev/null +++ b/scripts/log-run-dir.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Print the archive directory used for one workflow run's build logs, e.g. +# run started 2026-12-01T11:50:08Z, run id 46640252167 -> 2026-12-01-46640252167 +# +# Logs are published under /log//-.log so that every run +# keeps its own directory and older runs are never overwritten. The name is +# derived here rather than in the workflow for the same reason as +# log-file-name.sh: shell mistakes inside a `run:` block only surface in CI. +set -euo pipefail + +if [[ $# -ne 2 ]]; then + echo "Usage: log-run-dir.sh " >&2 + echo " run-started-at ISO-8601 timestamp, e.g. 2026-12-01T11:50:08Z" >&2 + echo " run-id numeric workflow run id" >&2 + exit 1 +fi + +started_at="$1" +run_id="$2" + +# Accept an ISO-8601 timestamp and take its UTC date. Everything after the date +# part is deliberately ignored: the run id already makes the directory unique. +if [[ ! "$started_at" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})T[0-9]{2}:[0-9]{2}:[0-9]{2} ]]; then + echo "Error: invalid run start time: $started_at" >&2 + echo "Expected an ISO-8601 timestamp such as 2026-12-01T11:50:08Z" >&2 + exit 1 +fi +year="${BASH_REMATCH[1]}" +month="${BASH_REMATCH[2]}" +day="${BASH_REMATCH[3]}" + +# The run id becomes a path component, so it must be digits only. +if [[ ! "$run_id" =~ ^[0-9]+$ ]]; then + echo "Error: invalid workflow run id: $run_id" >&2 + exit 1 +fi + +printf '%s-%s-%s-%s\n' "$year" "$month" "$day" "$run_id" diff --git a/scripts/stage-log-index.sh b/scripts/stage-log-index.sh new file mode 100755 index 0000000..1d89fb7 --- /dev/null +++ b/scripts/stage-log-index.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Build an index.html for /log/ that lists every run directory, including runs +# from previous publishes. +# +# publish-repo.sh generates its indexes from the staged tree, which only holds the +# current run. Now that each run is archived under its own directory, that index +# would hide every older run even though their files are still in the bucket, so +# the /log/ listing is rebuilt from the directory names that actually exist. +set -euo pipefail + +if [[ $# -lt 1 ]]; then + echo "Usage: stage-log-index.sh [run-dir...]" >&2 + echo " run-dir directory names under log/, e.g. 2026-12-01-46640252167" >&2 + exit 1 +fi + +output_dir="$1" +shift + +script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" + +rm -rf "$output_dir" +mkdir -p "$output_dir" + +if (( $# == 0 )); then + echo "Warning: no run directories supplied; writing an empty /log/ index" >&2 + "$script_dir/generate-index.sh" "$output_dir" \ + "ZGS · Build logs · Generated $(date -u '+%Y-%m-%d %H:%M UTC')" + exit 0 +fi + +for run_dir in "$@"; do + if [[ ! "$run_dir" =~ ^[A-Za-z0-9._-]+$ || "$run_dir" == "." || "$run_dir" == ".." ]]; then + echo "Warning: skipping unusable run directory name: $run_dir" >&2 + continue + fi + mkdir -p "$output_dir/$run_dir" + # Name starts with the run date; use it for the listing timestamp so an old run + # does not appear to have been published just now. + if [[ "$run_dir" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})- ]]; then + touch -d "${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]} 00:00:00 UTC" \ + "$output_dir/$run_dir" 2>/dev/null || true + fi +done + +"$script_dir/generate-index.sh" "$output_dir" \ + "ZGS · Build logs · Generated $(date -u '+%Y-%m-%d %H:%M UTC')" + +echo "Generated a /log/ index covering $(($#)) run director(y|ies)" >&2