From 0e8e287fe2a568e83b51537df3f0e0accef555c6 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Fri, 23 Aug 2024 21:22:31 +0800 Subject: [PATCH] update actions cache dir --- .github/actions/setup/action.yml | 3 +-- .github/workflows/beta-pack.yml | 24 +++++++++++++++----- .github/workflows/release.yml | 39 +++++++++++++++++++++++++------- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index a59983fe60..f66eb76db4 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -18,8 +18,7 @@ runs: id: cache-npm uses: actions/cache@v4 with: - path: | - ${{ env.NPM_CACHE }} + path: ${{ env.NPM_CACHE }} key: ${{ runner.os }}-npm-cache-${{ hashFiles('package-lock.json') }} restore-keys: | ${{ runner.os }}-npm-cache- diff --git a/.github/workflows/beta-pack.yml b/.github/workflows/beta-pack.yml index 8a13bf477f..f1f3cf1733 100644 --- a/.github/workflows/beta-pack.yml +++ b/.github/workflows/beta-pack.yml @@ -43,14 +43,18 @@ jobs: Windows: name: Windows runs-on: windows-latest - env: - NPM_CACHE: '%LocalAppData%/npm-cache' # needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v4 + - name: Get npm cache directory + shell: pwsh + run: echo "NPM_CACHE=$(npm config get cache)" >> $env:GITHUB_ENV + - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code @@ -130,8 +134,6 @@ jobs: name: Mac runs-on: macos-latest # needs: CheckCode - env: - NPM_CACHE: ~/.npm steps: - name: Check out git repository uses: actions/checkout@v4 @@ -143,7 +145,13 @@ jobs: source ~/.venv/bin/activate python3 -m pip install setuptools + - name: Get npm cache directory + shell: bash + run: echo "NPM_CACHE=$(npm config get cache)" >> $GITHUB_ENV + - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code @@ -177,8 +185,6 @@ jobs: Linux: name: Linux runs-on: ubuntu-latest - env: - NPM_CACHE: ~/.npm # needs: CheckCode steps: - name: Install package @@ -187,7 +193,13 @@ jobs: - name: Check out git repository uses: actions/checkout@v4 + - name: Get npm cache directory + shell: bash + run: echo "NPM_CACHE=$(npm config get cache)" >> $GITHUB_ENV + - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 838178d389..5de96c1618 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,14 +43,21 @@ jobs: Windows: name: Windows runs-on: windows-latest - env: - NPM_CACHE: '%LocalAppData%/npm-cache' # needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v4 + - name: Get npm cache directory + shell: pwsh + run: echo "NPM_CACHE=$(npm config get cache)" >> $env:GITHUB_ENV + + - name: Show Env + run: echo "${{ env.NPM_CACHE }}" + - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code @@ -77,14 +84,18 @@ jobs: Windows_7: name: Windows_7 runs-on: windows-latest - env: - NPM_CACHE: '%LocalAppData%/npm-cache' # needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v4 + - name: Get npm cache directory + shell: pwsh + run: echo "NPM_CACHE=$(npm config get cache)" >> $env:GITHUB_ENV + - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code @@ -114,8 +125,6 @@ jobs: Mac: name: Mac runs-on: macos-latest - env: - NPM_CACHE: ~/.npm # needs: CheckCode steps: - name: Check out git repository @@ -128,7 +137,15 @@ jobs: source ~/.venv/bin/activate python3 -m pip install setuptools + - name: Get npm cache directory + shell: bash + run: echo "NPM_CACHE=$(npm config get cache)" >> $GITHUB_ENV + + - name: Show Env + run: echo "${{ env.NPM_CACHE }}" - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code @@ -152,8 +169,6 @@ jobs: Linux: name: Linux runs-on: ubuntu-latest - env: - NPM_CACHE: ~/.npm # needs: CheckCode steps: - name: Install package @@ -162,7 +177,15 @@ jobs: - name: Check out git repository uses: actions/checkout@v4 + - name: Get npm cache directory + shell: bash + run: echo "NPM_CACHE=$(npm config get cache)" >> $GITHUB_ENV + + - name: Show Env + run: echo "${{ env.NPM_CACHE }}" - name: Setup Node Env + env: + NPM_CACHE: ${{ env.NPM_CACHE }} uses: ./.github/actions/setup - name: Build src code