Skip to content

Commit 8467afb

Browse files
authored
docs: prepare readme for v4 release (#240)
1 parent 314ae61 commit 8467afb

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
uses: actions/setup-node@v5
4141
with:
4242
node-version: ${{ matrix.node-version }}
43-
cache: pnpm
4443

4544
- name: Install dependencies
4645
run: pnpm install
@@ -83,7 +82,6 @@ jobs:
8382
uses: actions/setup-node@v5
8483
with:
8584
node-version: "24"
86-
cache: pnpm
8785

8886
- name: Install development dependencies
8987
run: pnpm install
@@ -136,7 +134,6 @@ jobs:
136134
uses: actions/setup-node@v5
137135
with:
138136
node-version: "24"
139-
cache: pnpm
140137

141138
- name: Install production dependencies
142139
run: pnpm install --production
@@ -252,6 +249,7 @@ jobs:
252249
uses: actions/setup-node@v5
253250
with:
254251
node-version: "24"
252+
package-manager-cache: false
255253

256254
- name: Download publish artifact
257255
uses: actions/download-artifact@v5

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
Publish packages to npm automatically in GitHub Actions by updating the version number.
1010

1111
- [Change log][releases]
12-
- [v2 to v3 migration guide](#v2-to-v3)
13-
- [v1 to v3 migration guide](#v1-to-v3)
12+
- [v3 to v4 migration guide](#v3-to-v4)
13+
- [v2 to v4 migration guide](#v2-to-v4)
14+
- [v1 to v4 migration guide](#v1-to-v4)
1415

1516
[releases]: https://github.com/JS-DevTools/npm-publish/releases
1617

@@ -54,13 +55,13 @@ jobs:
5455
publish:
5556
runs-on: ubuntu-latest
5657
steps:
57-
- uses: actions/checkout@v4
58-
- uses: actions/setup-node@v3
58+
- uses: actions/checkout@v5
59+
- uses: actions/setup-node@v5
5960
with:
60-
node-version: "20"
61+
node-version: "24"
6162
- run: npm ci
6263
- run: npm test
63-
- uses: JS-DevTools/npm-publish@v3
64+
- uses: JS-DevTools/npm-publish@v4
6465
with:
6566
token: ${{ secrets.NPM_TOKEN }}
6667
```
@@ -79,13 +80,13 @@ jobs:
7980
contents: read
8081
packages: write # allow GITHUB_TOKEN to publish packages
8182
steps:
82-
- uses: actions/checkout@v4
83-
- uses: actions/setup-node@v3
83+
- uses: actions/checkout@v5
84+
- uses: actions/setup-node@v5
8485
with:
85-
node-version: "20"
86+
node-version: "24"
8687
- run: npm ci
8788
- run: npm test
88-
- uses: JS-DevTools/npm-publish@v3
89+
- uses: JS-DevTools/npm-publish@v4
8990
with:
9091
token: ${{ secrets.GITHUB_TOKEN }}
9192
registry: "https://npm.pkg.github.com"
@@ -94,6 +95,7 @@ jobs:
9495
[workflow file]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions
9596
[npm authentication token]: https://docs.npmjs.com/creating-and-viewing-authentication-tokens
9697
[GitHub Package Registry]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry
98+
[good security practices]: https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions
9799

98100
### Action usage
99101

@@ -124,7 +126,7 @@ npm-publish exposes several output variables, which you can use in later steps o
124126

125127
```diff
126128
steps:
127-
- uses: JS-DevTools/npm-publish@v3
129+
- uses: JS-DevTools/npm-publish@v4
128130
+ id: publish
129131
with:
130132
token: ${{ secrets.NPM_TOKEN }}
@@ -285,17 +287,29 @@ Examples:
285287
Major releases of the action and libraries may contain breaking changes, documented here.
286288
For more detailed change logs, see [releases][].
287289

288-
### v2 to v3
290+
### v3 to v4
289291

290-
The v3 release does not require any changes to how you use `npm-publish` from `v2`. The version of Node.js used by the action was updated to v20 due to GitHub Action's [deprecation of Node.js v16][node16-deprecation]. The minimum required version of Node.js for the library and CLI remains v16.
292+
The `v4` release does not require any changes to how you use the `npm-publish` action from `v3`. The action was updated to Node 24 / npm 11.
293+
294+
In the library and CLI, support for Node 16 and Node 18 was dropped in `v4`, and the library API was switched to ESM-only. Library users should switch to ESM or update Node to a version with support for [loading ES modules using `require`][esm-require].
295+
296+
[esm-require]: https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require
297+
298+
### v2 to v4
299+
300+
The `v4` release does not require any changes to how you use the `npm-publish` action from `v2`. The action was updated to Node 20 in `v3` due to GitHub Action's [deprecation of Node 16][node16-deprecation], and then updated to Node 24 in `v4`.
301+
302+
In the library and CLI, support for Node 16 and Node 18 was dropped in `v4`, and the library API was switched to ESM-only. Library users should switch to ESM or update Node to a version with support for [loading ES modules using `require`][esm-require].
291303

292304
[node16-deprecation]: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
293305

294-
### v1 to v3
306+
### v1 to v4
295307

296308
The v2 release made several breaking changes to inputs, outputs, and behaviors that were present in `v1`. The examples below focus on the action, but the same changes are applicable to the library and CLI, too.
297309

298-
#### v2 option changes
310+
In the library and CLI, support for Node 16 and Node 18 was dropped in `v4`, and the library API was switched to ESM-only. Library users should switch to ESM or update Node to a version with support for [loading ES modules using `require`][esm-require].
311+
312+
#### option changes
299313

300314
The `check-version` and `greater-version-only` boolean options were replaced with the `strategy` option:
301315

@@ -319,9 +333,9 @@ The `check-version` and `greater-version-only` boolean options were replaced wit
319333
`check-version: false` has been removed. If you only need to publish, without first checking whether the version exists in the registry, you can [use `npm` directly][publishing-nodejs-packages] instead:
320334

321335
```diff
322-
- uses: actions/setup-node@v3
336+
- uses: actions/setup-node@v5
323337
with:
324-
node-version: '18'
338+
node-version: '24'
325339
+ registry-url: https://registry.npmjs.org/
326340
327341
- - uses: JS-DevTools/npm-publish@v1
@@ -335,7 +349,7 @@ The `check-version` and `greater-version-only` boolean options were replaced wit
335349

336350
[publishing-nodejs-packages]: https://docs.github.com/actions/publishing-packages/publishing-nodejs-packages
337351

338-
#### v2 output changes
352+
#### output changes
339353

340354
The `type` output is now an empty string instead of `'none'` when no release occurs
341355

@@ -345,15 +359,15 @@ The `type` output is now an empty string instead of `'none'` when no release occ
345359
+ if: ${{ steps.publish.outputs.type }}
346360
```
347361

348-
#### v2 behavior changes
362+
#### behavior changes
349363

350364
The `--ignore-scripts` option is now passed to `npm publish` as a security precaution. If you define any publish lifecycle scripts - `prepublishOnly`, `prepack`, `prepare`, `postpack`, `publish`, `postpublish` - we recommend you run that logic as a separate explicit build step.
351365

352366
```diff
353367
+ - run: npm run build
354368
355369
- - uses: JS-DevTools/npm-publish@v1
356-
+ - uses: JS-DevTools/npm-publish@v3
370+
+ - uses: JS-DevTools/npm-publish@v4
357371
with:
358372
token: ${{ secrets.NPM_TOKEN }}
359373
```
@@ -362,7 +376,7 @@ If you can't change your build, you can set the `ignore-scripts` input to `false
362376

363377
```diff
364378
- - uses: JS-DevTools/npm-publish@v1
365-
+ - uses: JS-DevTools/npm-publish@v3
379+
+ - uses: JS-DevTools/npm-publish@v4
366380
with:
367381
token: ${{ secrets.NPM_TOKEN }}
368382
+ ignore-scripts: false
@@ -371,13 +385,13 @@ If you can't change your build, you can set the `ignore-scripts` input to `false
371385
The global `.npmrc` file is no longer read nor modified. This means the `token` option is now required for the library and CLI. (It was already required for the action.) You may have workarounds in place referencing `INPUT_TOKEN`, which v1 [erroneously wrote][#15] to `.npmrc`. These workarounds should be removed.
372386

373387
```diff
374-
- uses: actions/setup-node@v3
388+
- uses: actions/setup-node@v5
375389
with:
376-
node-version: '18'
390+
node-version: '24'
377391
registry-url: https://registry.npmjs.org/
378392
379393
- - uses: JS-DevTools/npm-publish@v1
380-
+ - uses: JS-DevTools/npm-publish@v3
394+
+ - uses: JS-DevTools/npm-publish@v4
381395
with:
382396
token: ${{ secrets.NPM_TOKEN }}
383397

0 commit comments

Comments
 (0)