Using npm packages with Actions
It is very easy to set up a release workflow for packages with GitHub Actions. You can use GITHUB_TOKEN
to authenticate and the native clients of your package managers. To try it out with npm, you can follow the step-by-step instructions here: https://github.com/wulfland/package-demo.
You can create the package using npm init
if you have installed npm on your machine. Otherwise, just copy the contents of package.json
and package-lock.json
from the aforementioned repository.
The workflow to publish the package is simple. It gets triggered every time a new release is created:
on:
release:
types: [created]
The workflow consists of two jobs. The first one only builds and tests the package using npm:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
...