Skip to content

Commit 11b3eaf

Browse files
authored
ci: update release process (#374)
For more details on the release process, please read docs/RELEASE.md Now we restrict the files packaged using the files section of the package.json https://docs.npmjs.com/cli/v8/configuring-npm/package-json#files
1 parent 5448ac6 commit 11b3eaf

File tree

7 files changed

+11777
-107
lines changed

7 files changed

+11777
-107
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
name: publish
22

33
on:
4-
release:
5-
types: [released]
4+
push:
5+
tags:
6+
- "v*.*.*"
67

78
jobs:
8-
build:
9+
npm-publish-and-gh-release:
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/checkout@v3
1213
- uses: actions/setup-node@v3
1314
with:
14-
node-version: 16
15-
- run: npm ci
16-
- run: npm test
17-
18-
publish-npm:
19-
needs: build
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v3
23-
- uses: actions/setup-node@v3
24-
with:
25-
node-version: 16
15+
node-version: 18
2616
registry-url: https://registry.npmjs.org/
2717
- run: npm ci
18+
- run: npm test
2819
- run: npm publish
2920
env:
3021
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
22+
- uses: softprops/action-gh-release@v1
23+
with:
24+
generate_release_notes: true
25+
token: ${{ secrets.GH_TOKEN }}
3126

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
.vscode
3+
.npmrc

.release-it.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"npm": {
3+
"publish": false
4+
},
5+
"git": {
6+
"commitMessage": "chore: release v${version}",
7+
"push": false
8+
},
9+
"github":{
10+
"release": false
11+
},
12+
"plugins": {
13+
"@release-it/conventional-changelog": {
14+
"preset": "conventionalcommits",
15+
"infile": "CHANGELOG.md",
16+
"ignoreRecommendedBump": true
17+
}
18+
}
19+
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Tests](#tests)
1717
- [Contributing](#contributing)
1818
- [License](#license)
19+
- [Release](#release)
1920

2021
# Introduction
2122

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

9899
# License
99100
[MIT](https://github.com/IBM/nodejs-itoolkit/blob/master/LICENSE)
101+
102+
# Release
103+
104+
For information on making a release, read [RELEASE.md](docs/RELEASE.md).

docs/RELEASE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Release
2+
3+
To create a new release the developer first needs to run:
4+
5+
```sh
6+
npm run release
7+
```
8+
9+
This script will run [release-it](https://github.com/release-it/release-it) which will then prompt the user for the:
10+
11+
1) version
12+
2) commit message
13+
3) tag name (NOTE: Tag name should follow the pattern v*.*.*)
14+
15+
release-it should then:
16+
17+
- bump the version in the package.json and package-lock.json files
18+
- update CHANGELOG.md
19+
- make the release commit
20+
- create the tag
21+
22+
From there the developer needs to:
23+
24+
1) Review the changes made by release-it are as expected.
25+
2) Push the commit and tag to the main branch (requires proper authority)
26+
27+
```sh
28+
git push --follow-tags origin master
29+
```
30+
31+
Once the tag and commit is pushed to the main branch our [github action](../.github/workflows/publish.yml) will:
32+
33+
1) Create the GH release
34+
2) Publish the release to NPM

0 commit comments

Comments
 (0)