- enable fetch-depth for code_checkout - fetch master branch before checking for changed files - ensure the clean target is called with the default - improve makefile failure handling - ensure VAULT_ADDR is set before VAULT_TOKEN
This commit is contained in:
+3
-4
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check for changes in images/ folder and the builds/ folder
|
||||
git fetch origin master:master
|
||||
if [ "$(git branch --show-current)" = "master" ]; then
|
||||
builds_changes=$(git diff --name-only HEAD^...master | grep -E '^builds/')
|
||||
images_changes=$(git diff --name-only HEAD^...master | grep -E '^images/')
|
||||
@@ -11,7 +12,7 @@ fi
|
||||
|
||||
# Run `make all` if there are changes in builds/
|
||||
if [ -n "$builds_changes" ]; then
|
||||
echo "Changes detected in builds/. Running 'make build-all'..."
|
||||
echo "Changes detected in builds/. Running 'make all'..."
|
||||
make all
|
||||
fi
|
||||
|
||||
@@ -20,9 +21,7 @@ if [ -n "$images_changes" ]; then
|
||||
echo "Changes detected in images/. Running specific 'make' commands..."
|
||||
|
||||
# Extract unique paths for `make` commands
|
||||
for file in $images_changes; do
|
||||
# Get the subdirectory path for the make command (e.g., almalinux/8.10/actionsdind)
|
||||
target=$(echo "$file" | sed -E 's|images/||; s|/[^/]+$||')
|
||||
for target in $(echo $images_changes | sed -E 's|images/||; s|/[^/]+$||' | sort -u); do
|
||||
echo "Running 'make $target'..."
|
||||
make "$target"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user