Github Action for goreleaser-npm-publisher.
Automated tool for building and publishing NPM packages from Go binaries.
To publish your binaries to the registry, simply run
goreleaser-npm-publisher-action
after the goreleaser
action.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish NPM packages
uses: evg4b/goreleaser-npm-publisher-action@v1.0.0
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
prefix: @evg4b
files: |-
LICENSE
README.md
ROADMAP.md
Also, you can customize the packages with next options:
Option | Type | Description |
---|---|---|
project | string | Specifies the path to the root of the Go package. |
builder | string | The name of the builder whose output will be used for building the packages. |
clear | boolean | Clean the dist/npm folder before the build. |
prefix | string | NPM package scope prefix. |
description | string | NPM package description. |
files | string[] | Files that should be included in the NPM package (e.g., README.md , LICENSE by default). |
token | string | The NPM authentication token. |
Note
You can learn more about the internal processes of package building and the structure of platform-specific packages on the goreleaser-npm-publisher tool page.
goreleaser-npm-publishe
r recommends using the auth_token for authorization by
passing it in the corresponding parameter. If you require a different type of
authorization, you can run npm login before starting the action, which will also
work.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to the NPM
# Log into the registry using your preferred method.
run: npm login ...
- name: Build and publish NPM packages
uses: evg4b/goreleaser-npm-publisher-action@v1.0.0