Skip to content

Commit f0b6ad0

Browse files
datho7561rgrunber
authored andcommitted
Fix release GitHub Action
- setup-node@v5 creates a .npmrc if you provide a registry, so there should be no need to do that separately - after setup-node@v5 is run, `npm publish` expects the token to be accessible from the environment variable `NODE_AUTH_TOKEN` - also fix coveralls, because that's getting annoying (root cause is that it tried to publish the results for each platform instead of just once) See https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 3821411 commit f0b6ad0

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

.github/workflows/CI.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ jobs:
3535

3636
# Set up Node
3737
- name: Use Node 20
38-
uses: actions/setup-node@v4
38+
uses: actions/setup-node@v5
3939
with:
4040
node-version: 20
41+
registry-url: 'https://registry.npmjs.org'
4142

4243
# Run install dependencies
4344
- name: Install dependencies
@@ -69,20 +70,17 @@ jobs:
6970

7071
# Run Coveralls
7172
- name: Coveralls
73+
if: matrix.os == 'ubuntu-latest'
7274
uses: coverallsapp/github-action@c7885c00cb7ec0b8f9f5ff3f53cddb980f7a4412 # v2.2.0
7375
with:
7476
github-token: ${{ secrets.GITHUB_TOKEN }}
7577

7678
- name: Publish
7779
if: ${{ success() && runner.os == 'Linux' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
7880
run: |
79-
{
80-
echo "registry=https://registry.npmjs.com"
81-
echo "//registry.npmjs.com/:_authToken=${NPM_TOKEN}"
82-
} > .npmrc
8381
npm publish --tag next --no-git-tag-version --prepatch --preid "$(git rev-parse --short HEAD)"
8482
env:
85-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
83+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8684

8785
# Setup QEMU as requirement for docker
8886
- name: Set up QEMU

.github/workflows/release.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
# Set up Node
2626
- name: Use Node 20
27-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v5
2828
with:
2929
node-version: 20
3030
registry-url: 'https://registry.npmjs.org'
@@ -45,19 +45,11 @@ jobs:
4545
- name: Run Check Dependencies
4646
run: npm run check-dependencies
4747

48-
# Config .npmrc
49-
- name: Config .npmrc
50-
run: |
51-
{
52-
echo "registry=https://registry.npmjs.com"
53-
echo "//registry.npmjs.com/:_authToken=${NPM_TOKEN}"
54-
} > .npmrc
55-
5648
# Publish to npm
5749
- name: Publish to npm
5850
run: npm publish --access public
5951
env:
60-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
52+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
6153

6254
# Get the current package.json version so we can tag the image correctly
6355
- name: Get current package.json version

0 commit comments

Comments
 (0)