feat: add build workflows
Build / build (pull_request) Successful in 2m6s

- 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:
2025-01-25 16:42:27 +11:00
parent d936a21108
commit 8f3493b69d
5 changed files with 77 additions and 11 deletions
+5 -4
View File
@@ -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,9 @@ 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|/[^/]+$||')
export TARGETS=$(echo "$images_changes" | sed -E 's|images/||; s|/[^/]+$||' | sort -u)
echo $TARGETS
for target in $TARGETS; do
echo "Running 'make $target'..."
make "$target"
done