Skip to content

Commit

Permalink
Merge branch 'main' into DOP-5203
Browse files Browse the repository at this point in the history
  • Loading branch information
seungpark authored Nov 25, 2024
2 parents fd79446 + f729b9e commit 7591503
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ coverage/
.vscode/
.env
.swc/
bundle.zip
bundle.zip
# Local Netlify folder
.netlify
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ npm run build:clean:stage

:warning: Note: This will promote the contents of your local public directory. Your instance in staging may break or be outdated if you haven't run `npm run build` before `make stage`.

## Staging with Netlify

When a commit is pushed, this automatically triggers a Netlify build on your branch. For every push, a deploy and deploy preview will be generated.

By default, the master branch of `docs-landing` will be parsed with the parser version specified in the `Netlify.toml` and built using your branch as the frontend. If you'd like to build a different site or branch or build with a different parser version, this can be easily done by just updating the values in the Netlify.toml accordingly. Don't forget to update the `ORG_NAME` to `mongodb` or `10gen` depending on which org your repo belongs to!

## Releasing

We have configured an automatic release process using [GitHub Actions](https://github.com/features/actions) that is triggered by [npm-version](https://docs.npmjs.com/cli/version). To release a version, you must have admin privileges in this repo. Then proceed as follows:
Expand Down
16 changes: 9 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
# variables that need to be changed based on the content repo you're working on -------------------------------------------
TESTING_CONTENT_REPO=docs-landing # name of content repo
ORGANIZATION=mongodb # name of org, usually mongodb or 10gen
TESTING_ORGANIZATION=$1 # name of org, usually mongodb or 10gen
TESTING_REPO_NAME=$2 # name of content repo
TESTING_BRANCH_NAME=$3 # name of the branch
PARSER_VERSION=$4 # version of the parser to download
# -------------------------------------------------------------------------------------------------------------------------
PARSER_VERSION=0.18.6

# This make command curls the examples for certain repos.
# If the rule doesn't exist, the error doesn't interrupt the build process.
# make examples - we don't need this for docs-landing, but have it here for when we change repos

# cloning the content repo
echo "cloning content repo: ${TESTING_CONTENT_REPO}"
git clone https://github.com/${ORGANIZATION}/${TESTING_CONTENT_REPO}.git
echo "Cloning content repo: ${TESTING_REPO_NAME}"
git clone -b ${TESTING_BRANCH_NAME} https://github.com/${TESTING_ORGANIZATION}/${TESTING_REPO_NAME}.git



# running the parser
if [ ! -d "snooty-parser" ]; then
echo "snooty parser not installed, downloading..."
echo "Snooty parser not installed, downloading parser version $PARSER_VERSION ..."
curl -L -o snooty-parser.zip https://github.com/mongodb/snooty-parser/releases/download/v${PARSER_VERSION}/snooty-v${PARSER_VERSION}-linux_x86_64.zip
unzip -d ./snooty-parser snooty-parser.zip
chmod +x ./snooty-parser/snooty
fi

echo "======================================================================================================================================================================="
echo "========================================================================== Running parser... =========================================================================="
./snooty-parser/snooty/snooty build $(pwd)/${TESTING_CONTENT_REPO} --output=./bundle.zip
./snooty-parser/snooty/snooty build $(pwd)/${TESTING_REPO_NAME} --output=./bundle.zip
echo "========================================================================== Parser complete ============================================================================"
echo "======================================================================================================================================================================="

Expand Down
8 changes: 7 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ name = "snooty-cache-plugin"

[build]
publish = "public"
command = ". ./build.sh"
command = ". ./build.sh $ORG_NAME $REPO_NAME $BRANCH_NAME $PARSER_VERSION"

[build.environment]
ORG_NAME = "mongodb"
REPO_NAME = "docs-landing"
BRANCH_NAME = "master"
PARSER_VERSION = "0.18.6"

0 comments on commit 7591503

Please sign in to comment.