-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update examples link during release process
- Loading branch information
1 parent
2c63f39
commit d6fb86d
Showing
2 changed files
with
25 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
: "${1?"Tag of new release must be provided"}" | ||
|
||
FILE_PATH="./website/docs/index.html.markdown" | ||
RELEASE_TAG=$1 | ||
|
||
# Define the old URL pattern and new URL | ||
OLD_URL_PATTERN="\[example configurations\](https:\/\/github.com\/mongodb\/terraform-provider-mongodbatlas\/tree\/[a-zA-Z0-9._-]*\/examples)" | ||
NEW_URL="\[example configurations\](https:\/\/github.com\/mongodb\/terraform-provider-mongodbatlas\/tree\/$RELEASE_TAG\/examples)" | ||
|
||
|
||
TMP_FILE_NAME="docs.tmp" | ||
rm -f $TMP_FILE_NAME | ||
|
||
# Use sed to update the URL and write to temporary file | ||
sed "s|$OLD_URL_PATTERN|$NEW_URL|g" "$FILE_PATH" > "$TMP_FILE_NAME" | ||
|
||
# Move temporary file to original file | ||
mv "$TMP_FILE_NAME" "$FILE_PATH" | ||
|
||
echo "Link updated successfully in $FILE_PATH" |
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