Skip to content

Commit

Permalink
DOP-3949: Rename the "master" branch to "main" (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
i80and authored Jan 31, 2024
1 parent 6c80f5e commit d7ce37c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
test:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Uses [Gatsby](https://www.gatsbyjs.org/) to build static site.

## Installation

Snooty uses [artifactory](https://jfrog.com/artifactory/) that [will need authentication](https://github.com/mongodb/snooty/blob/master/.npmrc) to install some private npm packages. Update your local zsh variables in `$~/.zshrc` (in Windows `%USERPROFILE%/.zshrc`) to include the following
Snooty uses [artifactory](https://jfrog.com/artifactory/) that [will need authentication](https://github.com/mongodb/snooty/blob/main/.npmrc) to install some private npm packages. Update your local zsh variables in `$~/.zshrc` (in Windows `%USERPROFILE%/.zshrc`) to include the following

```
export NPM_BASE_64_AUTH=<BASE_64_API_KEY>
Expand Down Expand Up @@ -32,7 +32,7 @@ GATSBY_PARSER_BRANCH=<BRANCH>
GATSBY_SNOOTY_DEV=true
```

The `GATSBY_SNOOTY_DEV` variable is what allows Gatsby to know that it should use the snooty branch name as part of the file paths. When not set, the file paths will use the value of `GATSBY_PARSER_BRANCH`. See pathing [here](https://github.com/mongodb/snooty/blob/master/src/utils/generate-path-prefix.js#L22)
The `GATSBY_SNOOTY_DEV` variable is what allows Gatsby to know that it should use the snooty branch name as part of the file paths. When not set, the file paths will use the value of `GATSBY_PARSER_BRANCH`. See pathing [here](https://github.com/mongodb/snooty/blob/main/src/utils/generate-path-prefix.js#L22)

It should be set to `true` when working on snooty locally.

Expand All @@ -54,7 +54,7 @@ npm run develop
```

To build and serve the site, run the following commands:
The serve command generates the site at a [prefix](https://github.com/mongodb/snooty/blob/master/src/utils/generate-path-prefix.js) ie. `localhost:9000/<branch>/<docs-name>/<user>/<branch-name>/`
The serve command generates the site at a [prefix](https://github.com/mongodb/snooty/blob/main/src/utils/generate-path-prefix.js) ie. `localhost:9000/<branch>/<docs-name>/<user>/<branch-name>/`

```shell
$ npm run build
Expand Down Expand Up @@ -120,9 +120,9 @@ If your changes specifically affect Gatsby Cloud preview builds, set up and use

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:

1. On the `master` branch, run `git pull` followed by `npm ci`.
1. On the `main` branch, run `git pull` followed by `npm ci`.
2. Run `npm version [major | minor | patch]`, using [Semantic Versioning](https://semver.org) guidelines to correctly increment the version number. Keep the minor version consistent with [snooty-parser versioning](https://github.com/mongodb/snooty-parser/tags). GitHub Actions will create a new git tag and push it to GitHub.
3. Update the release draft found [here](https://github.com/mongodb/snooty/releases) using the automatically generated [CHANGELOG.md](https://github.com/mongodb/snooty/blob/master/CHANGELOG.md) and publish the release. Keep "pre-release" checked until version 1.0.0.
3. Update the release draft found [here](https://github.com/mongodb/snooty/releases) using the automatically generated [CHANGELOG.md](https://github.com/mongodb/snooty/blob/main/CHANGELOG.md) and publish the release. Keep "pre-release" checked until version 1.0.0.

:warning: This process cannot be completed if the releaser's `origin` points to a fork.

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
"clean": "gatsby clean",
"develop": "gatsby develop",
"develop:preview": "GATSBY_IS_PREVIEW=true gatsby develop",
"ensure-master": "node scripts/ensure-master.js",
"ensure-main": "node scripts/ensure-main.js",
"format": "npm run prettier -- --check",
"format:fix": "npm run prettier -- --write",
"lint": "eslint --ext .js,.jsx .",
"lint:fix": "npm run lint -- --fix --max-warnings 0",
"percy": "npm run build:clean && npm exec -- percy snapshot ./public -c .percy.yml",
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",
"postversion": "git push origin v$npm_package_version && git push origin master",
"postversion": "git push origin v$npm_package_version && git push origin main",
"prettier": "prettier '**/*.{js,jsx,json,md}'",
"preversion": "npm run ensure-master && npm run format && npm run lint && npm run test",
"preversion": "npm run ensure-main && npm run format && npm run lint && npm run test",
"serve": "gatsby serve --prefix-paths",
"test": "jest",
"test:unit": "jest unit",
Expand Down
2 changes: 1 addition & 1 deletion scripts/ensure-master.js → scripts/ensure-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getGitBranch = () => {
.replace(/[\n\r\s]+$/, '');
};

const ensureMaster = () => getGitBranch() === 'master';
const ensureMaster = () => ['main', 'master'].includes(getGitBranch());

const main = () => {
let warned = false;
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const REF_TARGETS = {
export const MARIAN_URL = process.env.GATSBY_MARIAN_URL || 'https://docs-search-transport.mongodb.com/';

// Class names to be used by mut for search indexing
// https://github.com/mongodb/mut/blob/master/mut/index/Document.py#L68
// https://github.com/mongodb/mut/blob/main/mut/index/Document.py#L68
export const MUT_CANDIDATES = {
mainColumn: 'main-column',
};

0 comments on commit d7ce37c

Please sign in to comment.