diff --git a/npm-publish/README.md b/npm-publish/README.md index 8ff0bbf..302ed18 100644 --- a/npm-publish/README.md +++ b/npm-publish/README.md @@ -13,6 +13,16 @@ Publishes the package to the NPM registry with configurable scope and registry U | `registry-url` |
Registry URL for publishing.
| `false` | `https://registry.npmjs.org/` | | `scope` |Package scope to use.
| `false` | `@ivuorinen` | | `package-version` |The version to publish.
| `false` | `${{ github.event.release.tag_name }}` | +| `npm_token` |NPM token.
| `true` | `""` | + +### Outputs + +| name | description | +|-------------------|-------------------------------------| +| `registry-url` |Registry URL for publishing.
| +| `scope` |Package scope to use.
| +| `package-version` |The version to publish.
| +| `npm_token` |NPM token.
| ### Runs @@ -40,4 +50,10 @@ This action is a `composite` action. # # Required: false # Default: ${{ github.event.release.tag_name }} + + npm_token: + # NPM token. + # + # Required: true + # Default: "" ``` diff --git a/npm-publish/action.yml b/npm-publish/action.yml index 83f03c9..cc4363c 100644 --- a/npm-publish/action.yml +++ b/npm-publish/action.yml @@ -21,6 +21,24 @@ inputs: description: 'The version to publish.' required: false default: ${{ github.event.release.tag_name }} + npm_token: + description: 'NPM token.' + required: true + default: '' + +outputs: + registry-url: + description: 'Registry URL for publishing.' + value: ${{ inputs.registry-url }} + scope: + description: 'Package scope to use.' + value: ${{ inputs.scope }} + package-version: + description: 'The version to publish.' + value: ${{ inputs.package-version }} + npm_token: + description: 'NPM token.' + value: ${{ inputs.token }} runs: using: composite @@ -31,12 +49,12 @@ runs: - name: Authenticate NPM shell: bash run: | - echo "//${{ inputs.registry-url }}/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + echo "//${{ inputs.registry-url }}/:_authToken=${{ inputs.npm_token }}" > ~/.npmrc - name: Publish Package shell: bash env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ inputs.npm_token }} run: | pkg_version=$(node -p "require('./package.json').version") if [ "$pkg_version" != "${{ inputs.package-version }}" ]; then