Skip to content

Commit

Permalink
chore: Update examples link during release process
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBettati committed Apr 15, 2024
1 parent 2c63f39 commit d6fb86d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/update-examples-reference-in-docs.sh
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"
1 change: 1 addition & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ We ship binaries but do not prioritize fixes for the following operating system

## Examples from MongoDB and the Community

<!-- NOTE: the below examples link is updated during the release process, when doing changes in the following sentence verify scripts/update-examples-reference-in-docs.sh is not impacted-->
We have [example configurations](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/master/examples)
in our GitHub repo that will help both beginner and more advanced users.

Expand Down

0 comments on commit d6fb86d

Please sign in to comment.