Skip to content

Commit

Permalink
chore: pnpm composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed Apr 25, 2023
1 parent 31e0032 commit a5fae23
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/actions/pnpm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Monorepo install (pnpm)'
description: 'Run pnpm install'

runs:
using: 'composite'

steps:
- uses: pnpm/action-setup@v2.2.4
with:
version: 8.4.0

- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path | tr -d '\n')" >> $GITHUB_OUTPUT
- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-config.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
# Prevent store to grow over time (not needed with yarn)
# Note: not perfect as it prune too much in monorepos so the idea
# is to use cache-rotation as above. In the future this might work better.
#- name: Prune pnpm store
# shell: bash
# run: pnpm prune store

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile --prefer-offline
env:
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install

0 comments on commit a5fae23

Please sign in to comment.