Skip to content

Commit

Permalink
ci: Add npm publish action (#161)
Browse files Browse the repository at this point in the history
- Add publish action derived from https://github.com/actions/starter-workflows/blob/9bca5754a6e9b132c49c1715085c747b21278dc9/ci/npm-publish.yml#L4
    Modified to skip  `npm ci` and running integration tests because this would fail on non IBM i systems.
- Document how to make a release
- Simplify the build and release commands by using npm scripts
  • Loading branch information
abmusse authored Oct 28, 2022
1 parent 99e127a commit a557c83
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Note that building isn't necessary for end-users and is more for developers look
```sh
git clone [email protected]:IBM/nodejs-idb-connector.git
cd nodejs-idb-connector
npm install --build-from-source
npm run build
```
## Build Dependencies
Note: sqlcli header files, GCC, and Python are required to compile the code.
Expand All @@ -119,6 +119,20 @@ Note: sqlcli header files, GCC, and Python are required to compile the code.
yum install python2
```

## Release

```sh
git clone [email protected]:IBM/nodejs-idb-connector.git
cd nodejs-idb-connector
npm install
npm run build-release

```

Create a new github release and attach the generated tar file in the `build` directory to the github release.

After the release is created the [publish](.github/workflows/publish.yml) action will automatically publish to npm.

## License

[`MIT`](https://github.com/IBM/nodejs-idb-connector/blob/master/LICENSE)
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
},
"scripts": {
"test": "ln -sf ./build-tmp-napi-v3 ./build && ./node_modules/mocha/bin/mocha.js --timeout 5s",
"install": "node-pre-gyp install --fallback-to-build"
"test-node-versions": "nodever 12 && npm test test/dataTypes.js && nodever 14 && npm test test/dataTypes.js && nodever 16 && npm test test/dataTypes.js && nodever 18 && npm test test/dataTypes.js",
"install": "node-pre-gyp install --fallback-to-build",
"build": "npm install --build-from-source",
"build-release": "./node_modules/.bin/node-pre-gyp rebuild --production && ./node_modules/.bin/node-pre-gyp package"
},
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.10",
Expand Down

0 comments on commit a557c83

Please sign in to comment.