Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
name: publish

on:
release:
types: [released]
push:
tags:
- "v*.*.*"

jobs:
build:
npm-publish-and-gh-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm test
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
token: ${{ secrets.GH_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.vscode
.npmrc
19 changes: 19 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"npm": {
"publish": false
},
"git": {
"commitMessage": "chore: release v${version}",
"push": false
},
"github":{
"release": false
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "conventionalcommits",
"infile": "CHANGELOG.md",
"ignoreRecommendedBump": true
}
}
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Tests](#tests)
- [Contributing](#contributing)
- [License](#license)
- [Release](#release)

# Introduction

Expand Down Expand Up @@ -97,3 +98,7 @@ Please read the [contribution guidelines](https://github.com/IBM/nodejs-itoolkit

# License
[MIT](https://github.com/IBM/nodejs-itoolkit/blob/master/LICENSE)

# Release

For information on making a release, read [RELEASE.md](docs/RELEASE.md).
34 changes: 34 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Release

To create a new release the developer first needs to run:

```sh
npm run release
```

This script will run [release-it](https://github.com/release-it/release-it) which will then prompt the user for the:

1) version
2) commit message
3) tag name (NOTE: Tag name should follow the pattern v*.*.*)

release-it should then:

- bump the version in the package.json and package-lock.json files
- update CHANGELOG.md
- make the release commit
- create the tag

From there the developer needs to:

1) Review the changes made by release-it are as expected.
2) Push the commit and tag to the main branch (requires proper authority)

```sh
git push --follow-tags origin master
```

Once the tag and commit is pushed to the main branch our [github action](../.github/workflows/publish.yml) will:

1) Create the GH release
2) Publish the release to NPM
Loading