Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache examples, update to latest actions #3

Merged
merged 9 commits into from
Aug 14, 2024
Merged
Changes from 1 commit
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
42 changes: 40 additions & 2 deletions .github/workflows/nvm.yml
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: node --version
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: |
nvm install --latest-npm --no-progress
echo "::set-env name=PATH::${NVM_BIN}:${PATH}"
echo "$(dirname $(which node))" >> $GITHUB_PATH
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
shell: bash --login {0}
- run: node --version

# Optional: Cache npm dependencies
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
karlhorky marked this conversation as resolved.
Show resolved Hide resolved

# Optional: Cache Yarn v1 dependencies
- name: Get yarn cache directory path
id: yarn-cache-dir-path
karlhorky marked this conversation as resolved.
Show resolved Hide resolved
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

# Optional: Cache pnpm store
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
ybiquitous marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-