Skip to content

Commit

Permalink
feat: remove pnpm caching; add working dir path (#9)
Browse files Browse the repository at this point in the history
* ref: move testing things into own folder
  • Loading branch information
Dafnik authored Apr 20, 2023
1 parent 888b327 commit f2db15c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ jobs:
- uses: actions/checkout@v3
- uses: ./
with:
cwd: "test"
install-ignore-scripts: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
test/node_modules
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ jobs:

- name: setup node and pnpm
uses: dafnik/setup-node-pnpm@v1
# with:
# pnpm: 8
# node: 18
# install: false
with:
# PNPM version to install
pnpm: 8

# Node version to install
node: 18

# Changes pnpm-lock.yaml lookup location and the work directory of "pnpm install" if enabled
cwd: "."

# Runs "pnpm install" in working directory
install: false

# Runs "pnpm install --ingore-scripts" in working directory
# Enable "install" or "install-ignore-scripts" only once
# install-ignore-scripts: false
```

Expand Down
39 changes: 19 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@ branding:

inputs:
pnpm:
description: 'PNPM version'
description: "PNPM version"
required: false
default: 8
node:
description: "Node version"
required: false
default: 18
cwd:
description: "Work directory"
required: false
default: "."
cache-dependency-path:
description: "Path to pnpm-lock.yaml"
required: false
default: "pnpm-lock.yaml"
install:
description: "Runs pnpm install"
required: false
default: 'false'
default: "false"
install-ignore-scripts:
description: "Runs pnpm install --ignore-scripts"
required: false
default: 'false'
default: "false"

runs:
using: "composite"
Expand All @@ -35,28 +43,19 @@ runs:
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node }}
cache: 'pnpm'

- name: get pnpm store directory
id: pnpm-dir
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: pnpm-cache
name: setup pnpm cache
with:
path: ${{ steps.pnpm-dir.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: "pnpm"
cache-dependency-path: "${{ inputs.cwd }}/pnpm-lock.yaml"

- name: Run pnpm install
if: "${{ inputs.install == 'true' }}"
shell: bash
run: pnpm install --frozen-lockfile
run: |
cd ${{ inputs.cwd }}
pnpm install --frozen-lockfile
- name: Run pnpm install --ignore-scripts
if: "${{ inputs.install-ignore-scripts == 'true' }}"
shell: bash
run: pnpm install --frozen-lockfile --ignore-scripts
run: |
cd ${{ inputs.cwd }}
pnpm install --frozen-lockfile --ignore-scripts
File renamed without changes.
File renamed without changes.

0 comments on commit f2db15c

Please sign in to comment.