Skip to content

Commit

Permalink
Add git management of files generated or deleted by make
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru committed May 22, 2024
1 parent 7220cd8 commit 3e83649
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ workflows/%.yml: .ALWAYS
if [[ $$enabled != "false" ]]; then \
echo updating $@; \
sed 's/%PACKAGE_NAME%/$*/g' package-template.yml | sed 's/%PACKAGE_JSON_NAME%/$(subst .,_,$*)/g' > $@; \
@git ls-files --error-unmatch $@ &> /dev/null || git add $@; \
else \
echo DELETING workflow $@ because package is disabled; \
rm -f $@; \
git rm -f --ignore-unmatch $@; \
fi

.PHONY : workflows .ALWAYS
Expand Down
7 changes: 5 additions & 2 deletions tasks/Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ $(LOCAL_BIN)/vert:

DESCRIPTION:
@# Use `tr -d '\"$'` to help guard against malicious input
@github-repo-metadata $(VENDOR) $(PACKAGE_REPO_NAME) "index" .description | tr -d '\"$$' | tee DESCRIPTION
@github-repo-metadata $(VENDOR) $(PACKAGE_REPO_NAME) "index" .description | tr -d '\"$$' | tee $@
git add $@

# In order to support static configuration of version, the VERSION file should be
# considered up-to-date unless explicitly updated via the "update" target
# VERSION:

LICENSE:
@github-repo-metadata $(VENDOR) $(PACKAGE_REPO_NAME) "license" .license.spdx_id | tr '[:lower:]' '[:upper:]' | tee LICENSE
@github-repo-metadata $(VENDOR) $(PACKAGE_REPO_NAME) "license" .license.spdx_id | tr '[:lower:]' '[:upper:]' | tee $@
git add $@

RELEASE: VERSION LICENSE DESCRIPTION
@if [ ! -f RELEASE ]; then \
Expand All @@ -149,6 +151,7 @@ RELEASE: VERSION LICENSE DESCRIPTION

init: AUTO_UPDATE_ENABLED=true
init: LICENSE DESCRIPTION $(PACKAGE_VERSION_TARGET) RELEASE
@git ls-files --error-unmatch "VERSION" &> /dev/null || git add VERSION

update: $(PACKAGE_VERSION_TARGET) RELEASE

Expand Down

0 comments on commit 3e83649

Please sign in to comment.