Skip to content

Commit f7bd623

Browse files
committed
Add release: scripts to package.json
And update the `readme` with instructions on how to use them
1 parent 3d08128 commit f7bd623

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

README.md

+20-14
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@ Boilerplate for a TypeScript npm package
66

77
## Includes
88

9-
- Jest TypeScript configuration
10-
- ESLint rules
11-
- `editorconfig` rules & enforcement
9+
- TypeScript configuration
10+
- `ts-jest` setup for automated testing
11+
- ESLint rules & `editorconfig` for linting
12+
- Prettier and ESLint for deterministic code formatting
1213
- CI - build, lint & test
13-
- CD - distribute to `npm` and `gpr` on version tags
14-
- Automatically populate GitHub releases
14+
- CD - automated publishing to both [npm](https://www.npmjs.com/) and the [GitHub Package Registry](https://github.com/features/packages)
15+
- GitHub Releases generated with automatic changelogs populated via a configurable template
1516
- Dependabot configuration
1617
- VSCode settings
1718

18-
## Publishing
19+
## Release / Publish
1920

20-
Publishing is handled by a continuous delivery workflow within GitHub Actions. By default, new versions are dual-published to both `npm` and the GitHub Package Registry. Comment one out in the `publish` workflow to only use one. If you would like to publish to `npm`, create a `NPM_TOKEN` repository secret.
21+
Publishing is handled by a continuous delivery workflow within GitHub Actions. By default, new versions are dual-published to both `npm` and `gpr` (the GitHub Package Registry.) Comment one out in `.github/workflows/publish.yml` to only use one. If you would like to publish to `npm`, create a `NPM_TOKEN` repository secret. Publishing to `gpr` does not require an auth token.
2122

22-
To publish a new release to `npm` / `gpr` / both, make sure your git repository is clean, and determine what kind of [semantic versioning](https://semver.org) bump this will require. Updates should fall into one of three categories: `major` (breaking changes) `minor` (new functionality without breaking changes) or `patch` (backwards compatible bug fixes).
23+
First, determine what kind of [semantic versioning](https://semver.org) bump this release will require. Updates should fall into one of three categories: `major` (new functionality with breaking changes) `minor` (new functionality without breaking changes) or `patch` (backwards compatible bug fixes).
2324

24-
After determining the version bump type, run `npm version` followed by the release version number you would like to increment. This will increment `package.json` automatically and add a git tag for the new version. So, for example, to publish a version that adds a new a feature, run `npm version minor`. Finally, run `git push --follow-tags` to push the commit and tag created by the prior command.
25+
To publish a new release, checkout the make sure your git repository is clean and run one of the following commands:
2526

26-
```sh
27-
npm version patch
28-
git push --follow-tags
29-
```
27+
- `npm run release:major` (new functionality with breaking changes)
28+
- `npm run release:minor` (new functionality without breaking changes)
29+
- `npm run release:patch` (backwards compatible bug fixes)
3030

31-
This will kick off the `release` workflow in Actions, which created a GitHub release with an automatically generated changelog populated by all PRs and commits in this version. The `publish` workflow is triggered as soon as the `release` workflow completes.
31+
Running any one of these will:
32+
33+
1. Increment the version number in `package.json`
34+
2. Create a git tag with the new version number
35+
3. Push these changes to GitHub, which triggers the `release` workflow in GitHub Actions
36+
4. The `release` workflow then creates a new GitHub release with changelog automatically populated with all PRs and commits since the last version
37+
5. The `publish` workflow is then triggered when the `release` workflow completes. It compiles the package and pushes it up to `npm` / `gpr`

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"clean": "rimraf lib",
3030
"format": "sort-package-json && prettier --write '**/*.ts' && eslint --fix .",
3131
"lint": "eslint . && ec .",
32-
"test": "npm run build && jest"
32+
"test": "npm run build && jest",
33+
"release:patch": "npm version patch && git push --follow-tags",
34+
"release:minor": "npm version minor && git push --follow-tags",
35+
"release:major": "npm version major && git push --follow-tags"
3336
},
3437
"devDependencies": {
3538
"@jessety/eslint-config": "^2.0.1",

0 commit comments

Comments
 (0)