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
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# workflow follows example in
# https://docs.github.com/en/actions/tutorials/publish-packages/publish-nodejs-packages#publishing-packages-to-the-npm-registry
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build

# https://docs.npmjs.com/cli/v11/commands/npm-publish
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,16 @@ Then open `example/index.html` for a simple example.
MIT © Imperial College of Science, Technology and Medicine

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.

## Publishing to NPM

Automatically publish to [NPM](https://www.npmjs.com). Assuming a version number 1.0.0:

* Create a [release on github](https://github.com/reside-ic/dfoptim/releases/new)
* Choose a tag -> Create a new tag: v1.0.0
* Use this version as the description
* Optionally describe the release
* Click "Publish release"
* This triggers the release workflow and the package will be available on NPM in a few minutes

Note: This package's name on NPM is `@reside-ic/dfoptim` not `dfoptim`.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dfoptim",
"version": "0.0.6",
"name": "@reside-ic/dfoptim",
"version": "1.0.0",
"description": "Derivative-Free Optimisation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down