forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docs): add script to sync docs/README.md with README.md (argopr…
- Loading branch information
Showing
4 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
target="docs/README.md" | ||
cp README.md $target | ||
|
||
replaceTarget() { | ||
# cross-platform for Linux and Mac, based off https://unix.stackexchange.com/a/381201/152866 | ||
sed -i.bak -e "$1" "$target" && rm $target.bak | ||
} | ||
|
||
# replace absolute links with relative links | ||
replaceTarget 's/(https:\/\/argo-workflows\.readthedocs\.io\/en\/latest\/\(.*\)\/)/(\1\.md)/' | ||
replaceTarget 's/walk-through\.md/walk-through\/index\.md/' # index routes need special handling | ||
# adjust existing relative links | ||
replaceTarget 's/(docs\//(/' # remove `docs/` prefix | ||
replaceTarget 's/(USERS\.md/(https:\/\/github\.com\/argoproj\/argo-workflows\/blob\/main\/USERS\.md/' # replace non-docs link with an absolute link | ||
replaceTarget 's/SECURITY\.md\](SECURITY/Security\](security/' # case-sensitive -- the file is docs/security.md vs. SECURITY.md. also remove the .md from a docs link | ||
|
||
# change text for docs self-link | ||
replaceTarget 's/.*View the docs.*/You'\''re here!/' |