1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00

Fix preview builds on CI (#19970)

Preview builds were setup to install correctly on CircleCI prior to
the Yarn v3 upgrade, but that integration broke with that upgrade. The
Yarn and CircleCI configuration has been updated to fix this.

The `.yarnrc.yaml` file has been updated to configure the GitHub
registry but leave it disabled by default. It can be enabled
dynamically using an environment variable. This lets us switch between
registries without updating the file.

The new workflow is documented here: https://github.com/MetaMask/core/pull/1481
This commit is contained in:
Mark Stacey 2023-07-12 19:50:31 -02:30 committed by GitHub
parent d1d39ee1cd
commit 7ef2730c9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -353,17 +353,15 @@ jobs:
echo "Not a PR; skipping" echo "Not a PR; skipping"
fi fi
- run: - run:
name: Setup registry config for using package previews on draft PRs name: Install dependencies
command: | command: |
if [[ $IS_DRAFT == 'true' ]] if [[ $IS_DRAFT == 'true' ]]
then then
printf '%s\n\n%s' '@metamask:registry=https://npm.pkg.github.com' "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_READ_TOKEN}" > .npmrc # Use GitHub registry on draft PRs, allowing the use of preview builds
METAMASK_NPM_REGISTRY=https://npm.pkg.github.com yarn --immutable
else else
echo "Not draft; skipping GitHub registry setup" yarn --immutable
fi fi
- run:
name: Install deps
command: yarn --immutable
- save_cache: - save_cache:
key: dependency-cache-v1-{{ checksum "yarn.lock" }} key: dependency-cache-v1-{{ checksum "yarn.lock" }}
paths: paths:

View File

@ -8,6 +8,15 @@ logFilters:
nodeLinker: node-modules nodeLinker: node-modules
npmRegistries:
"https://npm.pkg.github.com":
npmAlwaysAuth: true
npmAuthToken: "${GITHUB_PACKAGE_READ_TOKEN-}"
npmScopes:
metamask:
npmRegistryServer: "${METAMASK_NPM_REGISTRY:-https://registry.yarnpkg.com}"
plugins: plugins:
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs - path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js" spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js"