Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 4dff441

Browse files
Create NPM release docs and tooling (#64)
1 parent f283c87 commit 4dff441

File tree

4 files changed

+137
-10
lines changed

4 files changed

+137
-10
lines changed

.circleci/config.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,29 @@ release_tags: &release_tags
88
tags:
99
only: /^v\d+(\.\d+){2}(-.*)?$/
1010

11+
12+
docker_config: &docker_config
13+
docker:
14+
- image: circleci/node:11-browsers
15+
1116
version: 2.0
17+
workflows:
18+
version: 2
19+
test_and_publish:
20+
jobs:
21+
- test:
22+
filters: *release_tags
23+
- publish_npm:
24+
requires:
25+
- test
26+
filters:
27+
branches:
28+
ignore: /.*/
29+
<<: *release_tags
30+
1231
jobs:
13-
build:
14-
docker:
15-
- image: circleci/node:11-browsers
32+
test:
33+
<<: *docker_config
1634
steps:
1735
- checkout
1836
- run:
@@ -25,3 +43,39 @@ jobs:
2543
name: Submit coverage data to codecov.
2644
command: npm run codecov
2745
when: always
46+
publish_npm:
47+
<<: *docker_config
48+
steps:
49+
- checkout
50+
- run:
51+
name: Install modules and dependencies.
52+
command: npm install
53+
- run:
54+
name: Set NPM authentication.
55+
# Publish to NPM via the Google wombat bot that manages auth tokens,
56+
# so each token has authority to publish to just a single package.
57+
command: echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc
58+
- run: |
59+
cd packages/opencensus-web-all
60+
NPM_TOKEN="$WOMBAT_TOKEN_ALL"
61+
npm publish --registry https://wombat-dressing-room.appspot.com
62+
- run: |
63+
cd packages/opencensus-web-core
64+
NPM_TOKEN="$WOMBAT_TOKEN_CORE"
65+
npm publish --registry https://wombat-dressing-room.appspot.com
66+
- run: |
67+
cd packages/opencensus-web-exporter-ocagent
68+
NPM_TOKEN="$WOMBAT_TOKEN_EXPORTER_OCAGENT"
69+
npm publish --registry https://wombat-dressing-room.appspot.com
70+
- run: |
71+
cd packages/opencensus-web-instrumentation-perf
72+
NPM_TOKEN="$WOMBAT_TOKEN_INSTRUMENTATION_PERF"
73+
npm publish --registry https://wombat-dressing-room.appspot.com
74+
- run: |
75+
cd packages/opencensus-web-propagation-tracecontext
76+
NPM_TOKEN="$WOMBAT_TOKEN_PROPAGATION_TRACECONTEXT"
77+
npm publish --registry https://wombat-dressing-room.appspot.com
78+
- run: |
79+
cd packages/opencensus-web-types
80+
NPM_TOKEN="$WOMBAT_TOKEN_TYPES"
81+
npm publish --registry https://wombat-dressing-room.appspot.com

RELEASING.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Releasing OpenCensus Node Packages (for Maintainers Only)
2+
3+
This document explains how to publish all OC Node modules at version x.y.z.
4+
Ensure that you’re following [semver][semver-url] when choosing a version number.
5+
6+
## Update to latest locally
7+
8+
Use `git fetch` and `git checkout origin/master` to ensure you’re on the latest
9+
commit. Make sure you have no unstaged changes. Ideally, also use
10+
`git clean -dfx` to remove all ignored and untracked files.
11+
12+
## Create a new branch
13+
14+
Create a new branch called `x.y.z-proposal` from the current commit.
15+
16+
## Install packages and run the version bump script
17+
18+
Run `npm install` to make sure the packages are installed and built. Then run
19+
`npm run bump`, pick the version for `x.y.z`, and enter `y` for
20+
`Are you sure you want to publish these packages?` (They will not actually be
21+
published, just the version will be bumped).
22+
23+
The version bump should create some unstaged changes.
24+
25+
## Create a new commit
26+
27+
Create a new commit with the exact title: `chore(multiple): x.y.z release proposal`.
28+
29+
## Create a draft GitHub Release
30+
31+
On [GitHub Releases][github-releases-url],
32+
follow the example set by recent releases to populate a summary of changes, as
33+
well as a list of commits that were applied since the last release.
34+
Running `git log --oneline --no-decorate` is a good way to get that list of
35+
commits. Save it as a draft, don’t publish it. Don’t forget the tag -- call it
36+
`vx.y.z` and leave it pointing at `master` for now (this can be changed as long
37+
as the GitHub release isn’t published).
38+
39+
## Create a new PR
40+
41+
Push the branch to GitHub and create a new PR with that exact name. The commit
42+
body should just be a link to the *draft* notes. Someone who can access draft
43+
notes should approve it, looking in particular for test passing, and whether the
44+
draft notes are satisfactory.
45+
46+
## Merge and pull
47+
48+
Merge the PR, and pull the changes locally (using the commands in the first
49+
step). Ensure that `chore(multiple): x.y.z release proposal` is the most recent
50+
commit.
51+
52+
## Publish the GitHub Release
53+
54+
Publish the GitHub release, ensuring that the tag points to the newly landed
55+
commit corresponding to release proposal `x.y.z`.
56+
57+
## NPM publish happens automatically via CircleCI
58+
59+
Publishing the GitHub release will cause the release commit to be tagged as
60+
`vx.y.z`, which triggers a CircleCI `publish_npm` job that automatically
61+
publishes the packages to NPM. See the
62+
[OpenCensus Web CircleCI config][oc-web-circleci-url]
63+
64+
## Update CHANGELOG and release versions in examples
65+
* After releasing, you need to update all examples to the latest version.
66+
* In addition, update the CHANGELOG.md and start new Unreleased label.
67+
* Create a new commit with the exact title: `Post Release: update CHANGELOG, Examples and ReadMe`.
68+
* Go through PR review and merge it to GitHub master branch.
69+
70+
[semver-url]: https://semver.org/
71+
[github-releases-url]: https://github.com/census-instrumentation/opencensus-web/releases
72+
[oc-web-circleci-url]: https://github.com/census-instrumentation/opencensus-web/blob/master/.circleci/config.yml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"compile": "lerna run compile",
1111
"test": "lerna run test",
1212
"bootstrap": "lerna bootstrap",
13-
"bump": "lerna publish",
13+
"bump": "lerna publish --skip-npm --skip-git",
1414
"codecov": "lerna run codecov",
1515
"check": "lerna run check"
1616
},

packages/opencensus-web-all/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "@opencensus/web-all",
33
"version": "0.0.1",
4-
"description": "OpenCensus Web All combines all the main OpenCensus Web packages to provide distributions for easy use in web applications via <script> tags.",
4+
"description":
5+
"OpenCensus Web All combines all the main OpenCensus Web packages to provide distributions for easy use in web applications via <script> tags.",
56
"main": "build/src/index.js",
67
"types": "build/src/index.d.ts",
78
"scripts": {
89
"build:prod": "webpack --config ./webpack/prod-bundles.config.js",
910
"build:dev": "webpack --config ./webpack/dev-bundles.config.js",
10-
"start:webpack-server": "webpack-dev-server --config ./webpack/dev-bundles.config.js",
11+
"start:webpack-server":
12+
"webpack-dev-server --config ./webpack/dev-bundles.config.js",
1113
"test": "karma start --single-run",
1214
"test:start": "karma start",
1315
"codecov": "codecov -f coverage/*.json",
@@ -17,7 +19,8 @@
1719
"fix": "gts fix",
1820
"prepare": "npm run compile",
1921
"pretest": "npm run compile",
20-
"posttest": "npm run check"
22+
"posttest": "npm run check",
23+
"prepublishOnly": "npm run build:prod"
2124
},
2225
"repository": "census-instrumentation/opencensus-web",
2326
"keywords": [
@@ -71,7 +74,5 @@
7174
"@opencensus/web-instrumentation-perf": "^0.0.1",
7275
"@opencensus/web-propagation-tracecontext": "^0.0.1"
7376
},
74-
"sideEffects": [
75-
"./src/entrypoints/*.ts"
76-
]
77+
"sideEffects": ["./src/entrypoints/*.ts"]
7778
}

0 commit comments

Comments
 (0)