Skip to content

Commit d45dd03

Browse files
committed
add setup action
1 parent ca93518 commit d45dd03

File tree

5 files changed

+93
-1
lines changed

5 files changed

+93
-1
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
labels: []

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
checks: write
16+
pull-requests: write
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Prework
26+
run: |
27+
echo '{"name": "a", "version": "0.0.0", "scripts": {}}' > package.json
28+
printf 'lockfileVersion: '9.0'\nsettings:\n\tautoInstallPeers: true\n\texcludeLinksFromLockfile: false\nimporters:\n.: {}' > pnpm-lock.yaml
29+
30+
- name: Setup Node
31+
uses: actions-ext/node/setup@main
32+
with:
33+
version: '20.x'
34+
35+
- name: Install
36+
run: pnpm install

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# node
2-
Helper actions for node projects
2+
Helper actions for Node projects
3+
4+
| Name | Action Reference | Description |
5+
|:-----|:-----------------|:------------|
6+
| [setup](./setup) | actions-ext/node/setup | Setup Node with `pnpm` and caching |

setup/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# setup
2+
An action to setup Node with `pnpm` and caching.
3+
4+
## Usage
5+
6+
The following example yaml code will setup Node 20.x environment with pnpm and caching `pnpm-lock.yaml`.
7+
8+
```yaml
9+
- name: Setup Node
10+
uses: actions-ext/node/setup@v1
11+
with:
12+
manager: pnpm
13+
version: '20.x'
14+
```

setup/action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Setup Node
2+
description: 'Ensure NNode is installed, and setup pnpm with caching'
3+
4+
inputs:
5+
version:
6+
type: choice
7+
description: "Version to install"
8+
options:
9+
- '20.x'
10+
- '22.x'
11+
default: '20.x'
12+
package_json_file:
13+
type: string
14+
description: 'Path to package.json'
15+
default: 'js/package.json'
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 9
24+
package_json_file: ${{ inputs.package_json_file }}
25+
26+
- name: Set up Node ${{ inputs.version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ inputs.version }}
30+
cache: pnpm
31+
cache-dependency-path: '**/pnpm-lock.yaml'

0 commit comments

Comments
 (0)