From 96ea1ac3b1d402d4e9aa5b458b72cb5477b3e8de Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:54:09 -0500 Subject: [PATCH] Change default node-version-file to package.json (#6) * Change default node-version-file to package.json * Add node version * Update README * Remove node version * Update readme * Use latest setup-node --- README.md | 15 ++++++++++++++- action.yml | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c089411..53018cf 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,19 @@ Allows changing the `node-version` passed to `actions/setup-node`. node-version: 18 ``` +### `node-version-file` + +Allows changing the `node-version-file` passed to `actions/setup-node`. + +The default has changed from `actions/setup-node`'s `''` to `'package.json'`, enabling easy volta usage with 0 configuration for consumers of `wyvox/action-setup-pnpm`. +_not_ providing a volta config also have 0 consequence. + +```yaml +- uses: wyvox/action-setup-pnpm@v3 + with: + node-version-file: '.node-version' +``` + ### `node-registry-url` Allows changing the `registry-url` passed to `actions/setup-node`. @@ -82,7 +95,7 @@ steps: - uses: pnpm/action-setup@v2 with: version: 8 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: cache: 'pnpm' - run: pnpm install diff --git a/action.yml b/action.yml index 7ff8ff9..8659ac3 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: node-version: description: "Override the default node version, or override what is specified in your project's volta config" required: false + node-version-file: + description: "Override where the default node version is read from. By default this reads from package.json, which includes support for volta.node. Specifying node-version will override this" + required: false + default: 'package.json' node-registry-url: description: "Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN." required: false @@ -118,10 +122,13 @@ runs: # Note also that volta's action does not have formal support for pnpm, nor its cache. # - does not install pnpm - name: 'Setup node and the cache for pnpm' - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: cache: 'pnpm' + # If specified, takes precedence over node-version-file node-version: ${{ inputs.node-version }} + # Default node version read from package.json, but can be changed by passing in inputs.node-version-file + node-version-file: ${{ inputs.node-version-file }} registry-url: ${{ inputs.node-registry-url }} # It's only efficient to install dependencies