Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,5 @@
"groupName": "major-update"
}
],
"extends": [
"config:recommended",
":pinVersions",
"npm:unpublishSafe",
":prNotPending",
":preserveSemverRanges",
":rebaseStalePrs"
]
"extends": ["config:recommended", ":pinVersions", "npm:unpublishSafe", ":prNotPending", ":preserveSemverRanges", ":rebaseStalePrs"]
}
39 changes: 36 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cwd: 'test'
install-ignore-scripts: true

- name: Check version
- name: Check node version
id: check-version
run: |
NODE_VERSION=$(node -v)
Expand Down Expand Up @@ -47,17 +47,18 @@ jobs:
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != steps.check-pnpm-version.outputs.MATRIX_PNPM_VERSION_FIRST_PART }}
run: exit 1

test-version-file:
test-node-version-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
pnpm: 9
cwd: 'test'
node-file: '.node-version'
install-ignore-scripts: true

- name: check version
- name: check node version
id: check-node-version
run: echo "VERSION=$(node -v)" >> $GITHUB_OUTPUT

Expand All @@ -75,3 +76,35 @@ jobs:
- name: Fail on wrong pnpm version (${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART }})
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != '9' }}
run: exit 1

test-package-version-manager:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
node: 22
cwd: 'test/test-package-version-manager'
install-ignore-scripts: true

- name: check node version
id: check-node-version
run: |
NODE_VERSION=$(node -v)
NODE_VERSION_FIRST_PART=$(echo $NODE_VERSION | cut -d. -f1)
echo "NODE_VERSION_FIRST_PART=$NODE_VERSION_FIRST_PART" >> $GITHUB_OUTPUT

- name: fail on wrong version (${{ steps.check-node-version.outputs.NODE_VERSION_FIRST_PART }})
if: ${{ steps.check-node-version.outputs.NODE_VERSION_FIRST_PART != 'v22' }}
run: exit 1

- name: Check pnpm version
id: check-pnpm-version
run: |
PNPM_VERSION=$(pnpm -v)
PNPM_VERSION_FIRST_PART=$(echo $PNPM_VERSION | cut -d. -f1)
echo "PNPM_VERSION_FIRST_PART=$PNPM_VERSION_FIRST_PART" >> $GITHUB_OUTPUT

- name: Fail on wrong pnpm version (${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART }})
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != '9' }}
run: exit 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test/node_modules
test/test-package-version-manager/node_modules
/.idea/
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup node and pnpm
uses: dafnik/setup-node-pnpm@v3
uses: dafnik/setup-node-pnpm@v4
# with:
# pnpm: 8
# node: 22
# node-file: ''
# cwd: '.'
Expand All @@ -24,14 +23,15 @@ jobs:
```

<!-- prettier-ignore-start -->
| Inputs | Default value | Description |
|--------------------------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pnpm` | `9` | PNPM version to install |
| `node` | `22` | Version Spec of the version to use in SemVer notation.<br /> It also emits such aliases as lts, latest, nightly and canary builds.<br /> Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node |
| `node-file` | `''` | File containing the version Spec of the version to use.<br /> Examples: .nvmrc, .node-version, .tool-versions.<br /> If `node` and `node-file` are both provided the action will use version from `node-file`. |
| `cwd` | `.` | Changes pnpm-lock.yaml lookup location and the work directory of "pnpm install" if enabled |
| `install` | `false` | Runs "pnpm install" in working directory |
| `install-ignore-scripts` | `false` | Runs "pnpm install --ignore-scripts" in working directory. Enable "install" or "install-ignore-scripts" only once |
| Inputs | Default value | Description |
|--------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pnpm` | | PNPM version to install |
| `node` | `22` | Version Spec of the version to use in SemVer notation.<br /> It also emits such aliases as lts, latest, nightly and canary builds.<br /> Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node |
| `node-file` | `''` | File containing the version Spec of the version to use.<br /> Examples: .nvmrc, .node-version, .tool-versions.<br /> If `node` and `node-file` are both provided the action will use the version from `node-file`. |
| `cwd` | `.` | Changes pnpm-lock.yaml lookup location and the work directory of "pnpm install" if enabled |
| `package_file` | `package.json` | File path to the package.json to read "packageManager" configuration (also supports package.yml). Works in conjunction with "cwd" input. |
| `install` | `false` | Runs "pnpm install" in working directory |
| `install-ignore-scripts` | `false` | Runs "pnpm install --ignore-scripts" in working directory. Enable "install" or "install-ignore-scripts" only once |
<!-- prettier-ignore-end -->

Furthermore, see [action.yml](action.yml)
Expand Down
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ inputs:
pnpm:
description: 'PNPM version'
required: false
default: '9'
node:
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
required: false
default: '22'
node-file:
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.'
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions. If "node" and "node-file" are both provided the action will use the version from "node-file".'
required: false
default: ''
cwd:
description: 'Work directory'
required: false
default: '.'
package_file:
description: 'File path to the package.json to read "packageManager" configuration (also supports package.yml). Works in conjunction with "cwd"'
required: false
default: 'package.json'
install:
description: 'Runs pnpm install'
required: false
Expand All @@ -38,6 +41,7 @@ runs:
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm }}
package_json_file: '${{ inputs.cwd }}/${{ inputs.package_file }}'

- name: use Node.js ${{ inputs.node }}
if: "${{ inputs.node-file == '' }}"
Expand Down
13 changes: 13 additions & 0 deletions test/test-package-version-manager/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "test-package-version-manager",
"version": "1.0.0",
"packageManager": "pnpm@9.11.0",
"description": "",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "latest"
}
}
11 changes: 11 additions & 0 deletions test/test-package-version-manager/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.