Skip to content

Commit 63df6c7

Browse files
authored
Update publishing-nodejs-packages.md
The provided example doesn't work as acknowledged by the `setup-node` team, as of [github#926](actions/setup-node#926 (comment)). This is also a long known problem, see [github#249](actions/setup-node#249). This is considered to be a drastic measure to make sure the `setup-node` team takes responsibility for the problem.
1 parent 89fd377 commit 63df6c7

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

content/actions/publishing-packages/publishing-nodejs-packages.md

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -117,44 +117,6 @@ To perform authenticated operations against the {% data variables.product.prodna
117117

118118
If you want to publish your package to a different repository, you must use a {% data variables.product.pat_v1 %} that has permission to write to packages in the destination repository. For more information, see "[AUTOTITLE](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)" and "[AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions)."
119119

120-
### Example workflow
121-
122-
This example stores the `GITHUB_TOKEN` secret in the `NODE_AUTH_TOKEN` environment variable. When the `setup-node` action creates an `.npmrc` file, it references the token from the `NODE_AUTH_TOKEN` environment variable.
123-
124-
```yaml copy
125-
name: Publish package to GitHub Packages
126-
on:
127-
release:
128-
types: [published]
129-
jobs:
130-
build:
131-
runs-on: ubuntu-latest
132-
permissions:
133-
contents: read
134-
packages: write
135-
steps:
136-
- uses: {% data reusables.actions.action-checkout %}
137-
# Setup .npmrc file to publish to GitHub Packages
138-
- uses: {% data reusables.actions.action-setup-node %}
139-
with:
140-
node-version: {% ifversion actions-node20-support %}'20.x'{% else %}'16.x'{% endif %}
141-
registry-url: 'https://npm.pkg.github.com'
142-
# Defaults to the user or organization that owns the workflow file
143-
scope: '@octocat'
144-
- run: npm ci
145-
- run: npm publish
146-
env:
147-
NODE_AUTH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
148-
```
149-
150-
The `setup-node` action creates an `.npmrc` file on the runner. When you use the `scope` input to the `setup-node` action, the `.npmrc` file includes the scope prefix. By default, the `setup-node` action sets the scope in the `.npmrc` file to the account that contains that workflow file.
151-
152-
```shell
153-
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
154-
@octocat:registry=https://npm.pkg.github.com
155-
always-auth=true
156-
```
157-
158120
## Publishing packages using Yarn
159121

160122
If you use the Yarn package manager, you can install and publish packages using Yarn.

0 commit comments

Comments
 (0)