Repository: next.js
Issue: "No build cache found" on Ubuntu Instance with Github Actions
Labels: bug

### Link to the code that reproduces this issue

https://github.com/RebootGG/va-frontend

### To Reproduce

I'm building and deploying the app via Github actions, on an instance. 

Here is my `.github/workflow.yml` file : 

```
name: Deploy to Server

on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: self-hosted
    steps:
      - name: Cache Node.js modules
        uses: actions/cache@v3
        with:
          path: |
            ~/.npm
            ${{ github.workspace }}/.next/cache
          # Generate a new cache whenever packages or source files change.
          key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
          # If source files changed but packages didn't, rebuild from a prior cache.
          restore-keys: |
            ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-    
      
      - name: Checkout
        uses: actions/checkout@v4
        with:
          ssh-key: ${{ secrets.SSH_KEY }}
          
      - name: Execute Deployment Commands
        run: |
          git pull origin master
          npm install
          npm run build
          pm2 restart all
```

### Current vs. Expected behavior

Even though i'm using the instructions [from the docs](https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions), I still get the following message during the "`npm run build`" command: 

```
> build
> next build

⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
```

I would expect Next.js to retrieve the cache from the previous builds.

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
  Platform: linux
  Arch: x64
  Version: #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.0.4
  eslint-config-next: 14.0.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

Not sure

### Additional context

The cache seems to be downloaded, but somehow Next doesn't find it :

```
Run actions/cache@v3
  with:
    path: ~/.npm
  /root/actions-runner/_work/va-frontend/va-frontend/.next/cache
  
    key: Linux-nextjs-6bb[2](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:2)f629c7b0[3](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:3)d1f3e01[4](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:4)fce[5](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:5)fbf3aedff4103e5f979b0139[6](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:6)[7](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:7)69d65c6f2a037-295b79657cb53cda2396814005c5a2531f6dbd8b23165fdf8fea3736f852919b
    restore-keys: Linux-nextjs-6bb2f629c7b03d1f3e014fce5fbf3aedff4103e5f979b01396769d65c6f2a037-    
  
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false
  
Received 0 of 54097[8](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:8)381 (0.0%), 0.0 MBs/sec
Received 33554432 of 540[9](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:9)78381 (6.2%), 16.0 MBs/sec
Received 92274688 of 540978381 (17.1%), 29.3 MBs/sec
Received 171966464 of 540978381 (31.8%), 40.9 MBs/sec
Received 247463936 of 540978381 (45.7%), 47.1 MBs/sec
Received 339738624 of 540978381 (62.8%), 53.9 MBs/sec
Received 419430400 of 540978381 (77.5%), 57.1 MBs/sec
Received 5075[10](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:10)784 of 540978381 (93.8%), 60.4 MBs/sec
Cache Size: ~516 MB (540978381 B)
/usr/bin/tar -xf /root/actions-runner/_work/_temp/778c0a91-a8ff-4072-9d60-87ed1696616a/cache.tzst -P -C /root/actions-runner/_work/va-frontend/va-frontend --use-compress-program unzstd
Received 540978381 of 540978381 (100.0%), 57.2 MBs/sec
Cache restored successfully
Cache restored from key: Linux-nextjs-6bb2f629c7b03d1f3e014fce5fbf3aedff4103e5f979b0[13](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:14)96769d65c6f2a037-8519b6534f7ec366636c8d8a6de8dabdd0e7d3332808a0983a3fd[16](https://github.com/RebootGG/va-frontend/actions/runs/7186508940/job/19572051188#step:2:17)be6526eb3
```