2026-11-26 20:40:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Prints the services whose image has to be built for HEAD: those whose files
|
|
|
|
|
# changed since the last deployment (the newest v* release tag among HEAD's
|
|
|
|
|
# ancestors; the release step tags every deployment). Prints all of them when
|
|
|
|
|
# there is no such tag or the comparison fails, so a doubt builds everything.
|
|
|
|
|
# Needs the full history and the tags (git fetch --unshallow --tags).
|
|
|
|
|
#
|
|
|
|
|
# frontend services/frontend/
|
2026-11-27 17:09:14 +00:00
|
|
|
# backend, worker, forum, mcp their folder, the shared crates/, Cargo.toml, Cargo.lock
|
2026-11-26 20:40:43 +00:00
|
|
|
# horoscope-api the same, and scripts/fetch-deps.sh
|
|
|
|
|
set -u
|
2026-11-27 17:09:14 +00:00
|
|
|
ALL="horoscope-api backend worker forum mcp frontend"
|
2026-11-26 20:40:43 +00:00
|
|
|
prev=$(git describe --tags --abbrev=0 --match 'v*' HEAD 2>/dev/null) || { echo "$ALL"; exit 0; }
|
|
|
|
|
files=$(git diff --name-only "$prev" HEAD) || { echo "$ALL"; exit 0; }
|
|
|
|
|
changed() { printf '%s\n' "$files" | grep -Eq "$1"; }
|
|
|
|
|
rust='^(crates/|Cargo\.toml$|Cargo\.lock$)'
|
|
|
|
|
out=""
|
|
|
|
|
changed "^services/horoscope-api/|^scripts/fetch-deps\.sh$|$rust" && out="$out horoscope-api"
|
2026-11-27 17:09:14 +00:00
|
|
|
for svc in backend worker forum mcp; do
|
2026-11-26 20:40:43 +00:00
|
|
|
changed "^services/$svc/|$rust" && out="$out $svc"
|
|
|
|
|
done
|
|
|
|
|
changed '^services/frontend/' && out="$out frontend"
|
|
|
|
|
echo $out
|