Skip to content

Commit 5f1b395

Browse files
nullfunclionello
andauthored
Makefile fix and only run src/README.md sync on change (#1393)
* update header (was using old one). Update makefile to only run the src/README.md update when the root README.md has changed. * update makefile to only output message when src/README.md is regenerated * simplify src/README.md generation by using intrinsic functionality of Makefile * Update Makefile Co-authored-by: Lio李歐 <[email protected]> * Update Makefile for README.md sync to make sure users add src/README.md to commits * Update Makefile --------- Co-authored-by: Lio李歐 <[email protected]>
1 parent 9945a76 commit 5f1b395

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ pre-commit:
1010
@if git diff --cached --name-only | grep -q '^src/'; then make -C src lint; fi
1111

1212
.PHONY: pre-push
13-
pre-push: sync-readme
13+
pre-push: src/README.md
1414
@make -C src test
1515

1616
setup:
1717
go -C src mod tidy
1818

19-
.PHONY: sync-readme
20-
sync-readme:
21-
awk '/^## Develop Anything\. Deploy Anywhere\./{p=1} (/^## /||/^### /){if(p&&!/^## Develop Anything\. Deploy Anywhere\./){exit}} p' README.md > src/README.md; \
19+
src/README.md: README.md
20+
@awk '/^## Develop Once\. Deploy Anywhere\./{p=1} (/^## /||/^### /){if(p&&!/^## Develop Once\. Deploy Anywhere\./){exit}} p' README.md > src/README.md; \
2221
awk '/^## Defang CLI/{p=1} (/^## /||/^### /){if(p&&!/^## Defang CLI/){exit}} p' README.md >> src/README.md; \
2322
awk '/^## Getting started/{p=1} (/^## /||/^### /){if(p&&!/^## Getting started/){exit}} p' README.md >> src/README.md; \
2423
awk '/^## Support/{p=1} (/^## /||/^### /){if(p&&!/^## Support/){exit}} p' README.md >> src/README.md; \
25-
awk '/^## Environment Variables/{p=1} (/^## /||/^### /){if(p&&!/^## Environment Variables/){exit}} p' README.md >> src/README.md
24+
awk '/^## Environment Variables/{p=1} (/^## /||/^### /){if(p&&!/^## Environment Variables/){exit}} p' README.md >> src/README.md; \
25+
@echo 'src/README.md was updated because root README.md changed. Please add src/README.md to your commit.';
26+
@false

0 commit comments

Comments
 (0)