mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-28 17:57:48 +02:00
doc(v2): publish doc update after alpha.58 release (#2960)
* doc(v2): publish doc update after alpha.58 release * typo * publish doc update * Update publish.md Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
parent
459b2c56fd
commit
9301d0c861
2 changed files with 79 additions and 20 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,6 +15,7 @@ coverage
|
|||
.docusaurus
|
||||
.cache-loader
|
||||
types
|
||||
test-website
|
||||
packages/docusaurus-utils/lib/
|
||||
packages/docusaurus/lib/
|
||||
packages/docusaurus-init/lib/
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
# Publishing Instructions
|
||||
|
||||
Docusaurus is published as an npm package that can be installed via `npm` or `yarn`. Get access from the Docusaurus npm admins (@yangshun/@JoelMarcey).
|
||||
Docusaurus is published as an npm package that can be installed via `npm` or `yarn`.
|
||||
|
||||
## Log in to npm
|
||||
# Check publish rights
|
||||
|
||||
Get access from the Docusaurus npm admins (@yangshun/@JoelMarcey).
|
||||
|
||||
## GitHub
|
||||
|
||||
You need publish access to **the main Docusaurus repository** (not a fork).
|
||||
|
||||
## NPM
|
||||
|
||||
Publishing will only work if you are logged into npm with an account with publishing rights to the package.
|
||||
|
||||
|
@ -10,25 +18,41 @@ If you are not currently logged into npm on your CLI, do the following:
|
|||
|
||||
1. `npm login`
|
||||
1. Enter username, password and associated email address
|
||||
1. Make sure you have 2FA enabled on your account (preferably just for authorization)
|
||||
1. **Enable 2FA** on your account (preferably for D2: select 2FA mode `Authorization`, not `Authorization and Publishing`)
|
||||
|
||||
---
|
||||
|
||||
## Docusaurus 2
|
||||
|
||||
<!-- TODO: describe the process of hotfix releases -->
|
||||
|
||||
If you're publishing new v2 versions, 2FA might get in the way as the pin might expire during the publishing as there are over 10 packages to publish. You're encouraged not to use the "Authorization and Publishing" 2FA option.
|
||||
If you're publishing new v2 versions, 2FA might get in the way as the pin might expire during the publishing as there are over 10 packages to publish. Use 2FA mode `Authorization`, not `Authorization and Publishing`.
|
||||
|
||||
### 0. Build skeleton website with new version (Docker required)
|
||||
### 1. Git setup
|
||||
|
||||
To make sure that all packages will work correctly when they are published, you can build them locally and use them to run the skeleton website:
|
||||
Use the **master branch** (up to date) of the **main Docusaurus repository** (not a fork).
|
||||
|
||||
```bash
|
||||
Create a new branch for the release (the branch name does not matter much):
|
||||
|
||||
```sh
|
||||
git co -b <your_username>/<version_to_release>
|
||||
```
|
||||
|
||||
### 2. Build and test the project
|
||||
|
||||
Run `yarn install`
|
||||
|
||||
It should run `yarn tsc` and build the project's packages.
|
||||
|
||||
To make sure that all packages will work correctly when they are published, we can initialize a new D2 skeleton website, and test that it can start/built.
|
||||
|
||||
```sh
|
||||
yarn test:build:v2
|
||||
```
|
||||
|
||||
This command will build all the packages that it will publish to the running private npm proxy registry, and then initialize a new website in the `test-website` directory. Now you can start the dev server and/or make a production built.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd test-website
|
||||
yarn start
|
||||
yarn build # after manual testing in browser
|
||||
|
@ -36,11 +60,17 @@ yarn build # after manual testing in browser
|
|||
|
||||
If there are no errors, you can start preparing for the new release.
|
||||
|
||||
### 1. Update the v2 changelog
|
||||
**Note**: This step is also run by the CI on all pull requests ([see](https://github.com/facebook/docusaurus/pull/2954/checks?check_run_id=780871959))
|
||||
|
||||
Generate a GitHub auth token by going to https://github.com/settings/tokens. Save the token somewhere for future reference.
|
||||
### 3. Update the v2 changelog
|
||||
|
||||
> Before running the command below, get all tags from the original repository by running `git fetch --tags`.
|
||||
The changelog uses GitHub labels to classify each pull request. Use the GitHub interface to assign each newly merged pull request to a GitHub label starting with `tag:`, otherwise the PR won't appear in the changelog.
|
||||
|
||||
The `tag:` label prefix is for PRs only. Other labels are not used by the changelog tool, and it's not necessary to assign such labels to issues, only PRs.
|
||||
|
||||
Generate a GitHub auth token by going to https://github.com/settings/tokens (the only permission needed is `public_repo`). Save the token somewhere for future reference.
|
||||
|
||||
Generate the changelog with:
|
||||
|
||||
```sh
|
||||
GITHUB_AUTH=<Your GitHub auth token> yarn changelog
|
||||
|
@ -48,7 +78,7 @@ GITHUB_AUTH=<Your GitHub auth token> yarn changelog
|
|||
|
||||
Copy the generated contents and paste them in `CHANGELOG-2.x.md`.
|
||||
|
||||
### 2. Cut a new version of the docs
|
||||
### 4. Cut a new version of the docs
|
||||
|
||||
```sh
|
||||
cd website
|
||||
|
@ -57,11 +87,26 @@ yarn run docusaurus docs:version 2.0.0-alpha.41
|
|||
|
||||
Test running the website with the new version locally.
|
||||
|
||||
### 3. Create a Pull Request
|
||||
### 5. Create a Pull Request
|
||||
|
||||
Make a commit and create a pull request with the changes and get it merged. An example PR would be [#2287](https://github.com/facebook/docusaurus/pull/2287). Make sure the preview loads fine and is showing the new version.
|
||||
You should still be on your local branch `<your_username>/<version_to_release>`
|
||||
|
||||
### 4. Publish to npm
|
||||
Make a commit/push, create a pull request with the changes and get it merged.
|
||||
|
||||
If nobody is around for a review, just wait for the CI checks to complete, check the deploy preview, and merge it.
|
||||
|
||||
An example PR would be [#2287](https://github.com/facebook/docusaurus/pull/2287).
|
||||
|
||||
### 6. Build and publish to npm
|
||||
|
||||
Go back to the `master` branch, from which we'll do the release
|
||||
|
||||
```
|
||||
git checkout master
|
||||
git pull
|
||||
```
|
||||
|
||||
**Note**: the `git pull` is useful to update `master` with your recently merged PR. Unfortunately if you are unlucky this might as well include other code from other merged PRs. In such case you should ensure the extra code works correctly, and include it in the changelog. (**TODO**: make the release process more robust?)
|
||||
|
||||
As we have a monorepo structure, we use `lerna publish` to publish the new version of packages to npm in one shot.
|
||||
|
||||
|
@ -99,13 +144,24 @@ npm access ls-packages
|
|||
</pre>
|
||||
</details>
|
||||
|
||||
If all accesses are available, build all the necessary packages with `yarn tsc`, and then you can run the command to release a new version:
|
||||
It can happen that some accesses not granted, as an admin might add you to the @docusaurus NPM organisation, but you don't have access to the packages that are not in that organisation.
|
||||
|
||||
Please **double-check your permissions on these 3 packages**, otherwise you'll publish a half-release and will have to release a new version.
|
||||
|
||||
```
|
||||
"docusaurus": "read-write",
|
||||
"docusaurus-init": "read-write",
|
||||
"stylelint-copyright": "read-write"
|
||||
```
|
||||
|
||||
If all accesses are available, build all the necessary packages, and then run the lerna command to release a new version:
|
||||
|
||||
```sh
|
||||
yarn tsc
|
||||
yarn lerna publish 2.0.0-alpha.41 --dist-tag next
|
||||
```
|
||||
|
||||
_Note: The v1 packages will also be modified because it's part of the monorepo. It is not ideal but we will live with it for now._
|
||||
**Note**: The v1 packages will also be modified because it's part of the monorepo. It is not ideal but we will live with it for now.\_
|
||||
|
||||
This command does a few things:
|
||||
|
||||
|
@ -115,7 +171,7 @@ This command does a few things:
|
|||
|
||||
You should receive many emails notifying you that a new version of the packages has been published.
|
||||
|
||||
### 5. Create a release on GitHub
|
||||
### 7. Create a release on GitHub
|
||||
|
||||
- Go to https://github.com/facebook/docusaurus/releases/new
|
||||
- Under the "Tag version" field, look for the newly-created tag, which is `v2.0.0-alpha.41` in this case
|
||||
|
@ -123,9 +179,9 @@ You should receive many emails notifying you that a new version of the packages
|
|||
- Hit the green "Publish release" button
|
||||
- Profit! 💰
|
||||
|
||||
### 6. Notify people about new release (optional but desirable)
|
||||
### 8. Notify people about new release (optional but desirable)
|
||||
|
||||
After new release, it was cool to notify our users about this in the Dicsord chat (`docusaurus-users` channel) and write summaries in Twiiter using the following templates.
|
||||
After new release, it is cool to notify our users about this in the Dicsord chat (`docusaurus-users` channel) and write summaries on Twitter using the following templates.
|
||||
|
||||
For Discord:
|
||||
|
||||
|
@ -156,6 +212,8 @@ NOTE: most likely this last item will be relevant for each new release, so do no
|
|||
https://github.com/facebook/docusaurus/releases/tag/%VER%
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Docusaurus 1
|
||||
|
||||
1. Bump version number in [`package.json`](https://github.com/facebook/docusaurus/blob/master/package.json).
|
||||
|
|
Loading…
Add table
Reference in a new issue