fix(ci): add package.json.version to code cachekey

Before this, creating a release sometimes prevented vscode from
rebuilding and using the cache instead. Now we use the
package.json.version in the cache key to "bust" the cache if the
package.json version is updated (aka a release).

Fixes #5316
This commit is contained in:
Joe Previte 2022-07-19 09:22:09 -07:00
parent 6372aea4ba
commit 3cd3475540
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
1 changed files with 7 additions and 3 deletions

View File

@ -143,14 +143,18 @@ jobs:
id: vscode-rev id: vscode-rev
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)" run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
# We need to rebuild when we have a new version of Code or when any of - name: Get version
# the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild. id: version
run: echo "::set-output name=version::$(jq -r .version package.json)"
# We need to rebuild when we have a new version of Code or when any of
# the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild.
- name: Fetch prebuilt Code package from cache - name: Fetch prebuilt Code package from cache
id: cache-vscode id: cache-vscode
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: lib/vscode-reh-web-* path: lib/vscode-reh-web-*
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff') }} key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff') }}
- name: Build vscode - name: Build vscode
if: steps.cache-vscode.outputs.cache-hit != 'true' if: steps.cache-vscode.outputs.cache-hit != 'true'