Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dj #1

Open
terrancej opened this issue May 29, 2024 · 0 comments
Open

Dj #1

terrancej opened this issue May 29, 2024 · 0 comments
Assignees

Comments

@terrancej
Copy link
Owner

`# Makefile

Define the DEPLOYMENT variable

DEPLOYMENT := your_deployment_name

Define the rule to find the most recently modified directory using find

find_recent_dir:
@if [ "$(shell uname)" = "Darwin" ]; then
recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))" -exec stat -f '%m %N' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-);
else
recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))
" -exec stat --format='%Y %n' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-);
fi;
if [ -z "$$recent_dir" ]; then
echo "No directory found matching the base name of $(DEPLOYMENT)";
else
echo "The most recently modified directory is: $$recent_dir";
fi

Example usage of the find_recent_dir rule

deploy: find_recent_dir
@echo "Deploying to the most recent directory..."
# Here you can add additional commands to deploy to the directory found `

@terrancej terrancej self-assigned this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant