feat: add pnpm cache
Some checks failed
Deploy to GitHub Pages / deploy (push) Has been cancelled
Deploy to GitHub Pages / build (push) Has been cancelled

This commit is contained in:
max_richter 2024-04-03 16:48:10 +02:00
parent 59d6095278
commit 116ea85df7

View File

@ -11,6 +11,8 @@ permissions:
jobs: jobs:
build: build:
env:
RUNNER_TOOL_CACHE: /toolcache
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout your repository using git - name: Checkout your repository using git
@ -20,28 +22,24 @@ jobs:
run: apt update && apt install git-lfs zstd run: apt update && apt install git-lfs zstd
- name: 📦 Install PNPM - name: 📦 Install PNPM
uses: https://github.com/pnpm/action-setup@v2 uses: https://github.com/pnpm/action-setup@v3
id: pnpm-install id: pnpm-install
with: with:
version: 7 version: 8
run_install: false run_install: false
- name: 🔢 Calculate cache ids - name: Get pnpm store directory
shell: bash
run: | run: |
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
LFS_CACHE_ID=$(cat .lfs-assets-id | md5sum)-v2 # Get the GitHub repository name
PNPM_CACHE_ID=$( cat pnpm-lock.yaml | md5sum )-v2q
echo "LFS_CACHE_ID=$LFS_CACHE_ID" >> $GITHUB_ENV
echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
echo "PNPM_CACHE_ID=$PNPM_CACHE_ID" >> $GITHUB_ENV
- name: 🗳️ Setup pnpm cache - uses: actions/cache@v4
uses: https://github.com/actions/cache@v4 name: Setup pnpm cache
with: with:
path: ${{ env.PNPM_STORE_PATH }} path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ env.PNPM_CACHE_ID }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pnpm-store ${{ runner.os }}-pnpm-store-
- name: 📥 Checkout lfs files - name: 📥 Checkout lfs files
run: git lfs pull run: git lfs pull
@ -49,12 +47,8 @@ jobs:
- name: 📦 Install pnpm packages - name: 📦 Install pnpm packages
run: pnpm install run: pnpm install
- name: Build Website - name: Install, build, and upload your site output
run: pnpm build uses: withastro/action@v2
# with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
deploy: deploy:
needs: build needs: build