Skip to content

Commit

Permalink
build: Improve release build & process instructions (#540)
Browse files Browse the repository at this point in the history
* docs(README): Improve publishing instructions

* Update instructions and yarn deploy

* Improve MARKDOWN usage

* Update README.md

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

* Update README.md

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
  • Loading branch information
emostov and TarikGul committed May 7, 2021
1 parent 850d9e0 commit ea5b40e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
77 changes: 38 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,67 +268,66 @@ curl -s http://0.0.0.0:8080/blocks/head | jq

Need help or want to contribute ideas or code? Head over to our [CONTRIBUTING](CONTRIBUTING.md) doc for more information.

## Note for maintainers
## Notes for maintainers

* Commits && Releases && Publishing
### Commits

All the commits in this repo follow the [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/#summary). When merging a PR, make sure 1/ to
use squash merge and 2/ that the title of the PR follows the Conventional Commits spec.
All the commits in this repo follow the [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/#summary). When merging a PR, make sure 1) to use squash merge and 2) that the title of the PR follows the Conventional Commits spec.

### Step 1 - Preparation
### Releases

#### Preparation

1. Checkout a branch `name-v5-0-1`. When deciding what version will be released it is important to look over 1) PRs since the last release and 2) release notes for any updated polkadot-js dependencies as they may affect type definitions.

2. Ensure we have the latest polkadot-js dependencies
1. Ensure we have the latest polkadot-js dependencies. Note: Every monday the polkadot-js ecosystem will usually come out with a new release. It's important that we keep up, and read the release notes for any breaking changes, or high priority updates. You can use the following command `yarn upgrade-interactive` to find and update all available releases. Feel free to update other packages that are available for upgrade if reasonable. To upgrade just `@polkadot` scoped deps use `yarn up "@polkadot/*"`

* @polkadot/api [release notes](https://github.com/polkadot-js/api/releases)
* @polkadot/apps-config [release notes](https://github.com/polkadot-js/apps/releases)
* @polkadot/util-crypto [release notes](https://github.com/polkadot-js/common/releases)
* @polkadot/api [release notes](https://github.com/polkadot-js/api/releases)
* @polkadot/apps-config [release notes](https://github.com/polkadot-js/apps/releases)
* @polkadot/util-crypto [release notes](https://github.com/polkadot-js/common/releases)

Note: Every monday the polkadot-js ecosystem will usually come out with a new release. It's important that we keep up, and read the release notes for any breaking changes, or high priority updates. You can use the following command `yarn upgrade-interactive` to find and update all available releases. Feel free to update other packages that are available for upgrade if reasonable.
1. After updating the dependencies, the next step is making sure the release will work against all noted runtimes for Polkadot, Kusama, and Westend. This can be handled via the [sidecar-runtime-test](https://github.com/TarikGul/sidecar-runtime-test) helper library. Instructions for how to run it are in the repos README.md. Before moving forward ensure all tests pass, and if it warns of any missing types feel free to make an issue [here](https://github.com/paritytech/substrate-api-sidecar/issues).

3. After updating the dependencies, the next step is making sure the release will work against all noted runtimes for Polkadot, Kusama, and Westend. This can be handled via the [sidecar-runtime-test](https://github.com/TarikGul/sidecar-runtime-test) helper library. Instructions for how to run it are in the repos README.md. Before moving forward ensure all tests pass, and if it warns of any missing types feel free to make an issue [here](https://github.com/paritytech/substrate-api-sidecar/issues).
1. Update the version in the package.json (this is very important for releasing on NPM).

4. Update the version in the package.json (this is very important for releasing on NPM).
1. Update `CHANGELOG.md` by looking at merged PRs since the last release. Follow the format of previous releases. Only record dep updates if they reflect type definition updates as those affect the users API.

5. Update `CHANGELOG.md` by looking at merged PRs since the last release. Follow the format of previous releases.
* Make sure to note if it is a high upgrade priority (e.g. it has type definitions for an upcoming runtime upgrade to a Parity maintained network).

* Make sure to note if it is a high upgrade priority (e.g. it has type definitions for an upcoming runtime upgrade to a Parity maintained network).
1. Commit with ex: `chore(release): 5.0.1`, then `git push` your release branch up, make a PR, get review approval, then merge.

6. Commit with ex: `chore(release): 5.0.1`, then push your release up, make a PR, get review approval, then merge.
* NOTE: Before pushing up as a sanity check run the 3 following commands and ensure they all run with zero errors. There is one exception with `yarn test` where you will see errors logged, that is expected as long as all the test suites pass.

* NOTE: Before pushing up as a sanity check run the 3 following commands and ensure they all run with zero errors. There is one exception with `yarn test` where you will see an `InternalServerError`, that is alright. As long as all the test suites pass.
```bash
$ yarn test
$ yarn build
$ yarn lint
```
```bash
yarn build
yarn lint
yarn test
```

### Release && Pubishing to NPM and Github
#### Publish on GitHub

** NPM **
1. Now that master has the commit for the release, pull down `master` branch.

NOTE: You must be a member of the @substrate NPM org and must belong to the developers team within the org. (Please make sure you have 2FA enabled.)
1. Make sure the tag reflects your corresponding version, and run:

1. Now that master has the commit for the release, pull down master. Run `yarn build` to ensure the target JS build is there for the NPM release.
```bash
git tag v5.0.1
git push origin v5.0.1
```

2. Run the following commands. (Please ensure you have 2FA enabled)
1. Go to [tags](https://github.com/paritytech/substrate-api-sidecar/tags) on github, inside of the repo, and click the three dots to the far right and select the option to create a release.

```bash
$ yarn npm login
...
$ yarn npm publish
```
1. Generally you can copy the changelog information and set the release notes to that. You can also observe past releases as a reference.

** Github **
#### Publish on NPM

1. Make sure the tag reflects your corresponding version, and run:
NOTE: You must be a member of the `@substrate` NPM org and must belong to the `Developers` team within the org. (Please make sure you have 2FA enabled.)

```bash
git tag -s v5.0.1
git push origin v5.0.1
```
1. Now that master has the commit for the release, pull down `master` branch.

2. Go to tags on github, inside of the repo, and click the three dots to the far right and select the option to create a release.
2. Run the following commands. (Please ensure you have 2FA enabled)

3. Generally you can copy the changelog information and set the release notes to that. You can also observe past releases as a reference.
```bash
npm login # Only necessary if not already logged in
yarn deploy # Builds JS target and then runs npm publish
```
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@
"bugs": {
"url": "https://github.com/paritytech/substrate-api-sidecar/issues"
},
"files": [
"build"
],
"scripts": {
"build": "rimraf build/ && tsc",
"build:calc": "bash ./calc/build.sh",
"build:docker": "docker build -t substrate-api-sidecar .",
"build:docs": "(cd docs && yarn && yarn build)",
"main": "node ./build/src/main.js",
"lint": "substrate-dev-run-lint",
"deploy": "yarn build && standard-version",
"deploy": "yarn build && npm publish",
"start": "yarn run main",
"start:log-rpc": "yarn run build && NODE_ENV=test yarn run main ",
"dev": "tsc-watch --onSuccess \"yarn run main\"",
Expand Down

0 comments on commit ea5b40e

Please sign in to comment.