Give step names for clarity (#6) #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nvm | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
# Optional: Set up pnpm | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Show pre-installed Node.js version | |
run: node --version | |
- uses: actions/checkout@v4 | |
- name: Install Node.js via nvm | |
shell: bash --login {0} | |
run: | | |
nvm install --latest-npm --no-progress | |
echo "$(dirname $(nvm which node))" >> $GITHUB_PATH | |
- name: Show newly installed Node.js version | |
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 | |
- name: Store npm cache | |
uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
# Optional: Cache Yarn v1 dependencies | |
- name: Get yarn cache directory | |
id: yarn-cache-dir | |
shell: bash | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Store yarn cache | |
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.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Optional: Cache pnpm store | |
- name: Get pnpm store directory | |
id: pnpm-cache-dir | |
shell: bash | |
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.pnpm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- |