Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in latest from main #1312

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOP-5159 Specify content repo and parser version in build script for …
…Netlify Frontend Builds (#1309)
  • Loading branch information
anabellabuckvar authored Nov 22, 2024
commit 474dab53f6f82a5aa43f7bd22f326617d115365a
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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
@@ -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:
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 "======================================================================================================================================================================="

8 changes: 7 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -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"