diff --git a/.circleci/config.yml b/.circleci/config.yml
index 61493189a8b6..037ecd9126ed 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1413,10 +1413,6 @@ jobs:
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- # important: generate lavamoat viz AFTER uploading builds as artifacts
- - run:
- name: build:lavamoat-viz
- command: ./.circleci/scripts/create-lavamoat-viz.sh
- store_artifacts:
path: build-artifacts
destination: build-artifacts
diff --git a/.github/workflows/build-lavamoat-viz.yml b/.github/workflows/build-lavamoat-viz.yml
new file mode 100644
index 000000000000..505dbcc7709a
--- /dev/null
+++ b/.github/workflows/build-lavamoat-viz.yml
@@ -0,0 +1,23 @@
+name: Build LavaMoat visualization
+
+on:
+ workflow_call:
+
+jobs:
+ build-lavamoat-viz:
+ name: Build LavaMoat visualization
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup environment
+ uses: metamask/github-tools/.github/actions/setup-environment@main
+
+ - name: Build LavaMoat visualization
+ run: ./development/create-lavamoat-viz.sh
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: lavamoat-build-viz
+ path: ./build-artifacts/build-viz/
diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml
index 9b4e460d546a..6561b044b4d0 100644
--- a/.github/workflows/publish-prerelease.yml
+++ b/.github/workflows/publish-prerelease.yml
@@ -7,8 +7,30 @@ on:
required: true
jobs:
+ lavamoat-build-viz:
+ name: Build LavaMoat build visualization
+ runs-on: ubuntu-latest
+ outputs:
+ ARTIFACT_ID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup environment
+ uses: metamask/github-tools/.github/actions/setup-environment@main
+
+ - name: Build LavaMoat visualization
+ run: ./development/create-lavamoat-viz.sh
+
+ - uses: actions/upload-artifact@v4
+ id: artifact-upload-step
+ with:
+ name: lavamoat-build-viz
+ path: ./build-artifacts/build-viz/
+
publish-prerelease:
name: Publish prerelease
+ needs: lavamoat-build-viz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
@@ -61,6 +83,12 @@ jobs:
mkdir "storybook-build"
echo "${stories}" > "storybook-build/stories.json"
+ - name: Download LavaMoat build visualization
+ uses: actions/download-artifact@v4
+ with:
+ name: lavamoat-build-viz
+ path: ./build-artifacts/build-viz/
+
- name: Publish prerelease
env:
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
@@ -69,4 +97,5 @@ jobs:
MERGE_BASE_COMMIT_HASH: ${{ steps.get-merge-base.outputs.MERGE_BASE }}
CIRCLE_BUILD_NUM: ${{ steps.get-circleci-job-details.outputs.CIRCLE_BUILD_NUM }}
CIRCLE_WORKFLOW_JOB_ID: ${{ steps.get-circleci-job-details.outputs.CIRCLE_WORKFLOW_JOB_ID }}
+ LAVAMOAT_BUILD_VIZ_ID: ${{needs.lavamoat-build-viz.outputs.ARTIFACT_ID}}
run: ./development/metamaskbot-build-announce.js
diff --git a/.circleci/scripts/create-lavamoat-viz.sh b/development/create-lavamoat-viz.sh
similarity index 100%
rename from .circleci/scripts/create-lavamoat-viz.sh
rename to development/create-lavamoat-viz.sh
diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js
index d449c8ce7259..65911f73d9e4 100755
--- a/development/metamaskbot-build-announce.js
+++ b/development/metamaskbot-build-announce.js
@@ -58,6 +58,7 @@ async function start() {
MERGE_BASE_COMMIT_HASH,
CIRCLE_BUILD_NUM,
CIRCLE_WORKFLOW_JOB_ID,
+ LAVAMOAT_BUILD_VIZ_ID,
} = process.env;
console.log('PR_NUMBER', PR_NUMBER);
@@ -65,6 +66,7 @@ async function start() {
console.log('MERGE_BASE_COMMIT_HASH', MERGE_BASE_COMMIT_HASH);
console.log('CIRCLE_BUILD_NUM', CIRCLE_BUILD_NUM);
console.log('CIRCLE_WORKFLOW_JOB_ID', CIRCLE_WORKFLOW_JOB_ID);
+ console.log('LAVAMOAT_BUILD_VIZ_ID', LAVAMOAT_BUILD_VIZ_ID);
if (!PR_NUMBER) {
console.warn(`No pull request detected for commit "${HEAD_COMMIT_HASH}"`);
@@ -165,7 +167,7 @@ async function start() {
const tsMigrationDashboardLink = `Dashboard`;
// links to bundle browser builds
- const depVizUrl = `${BUILD_LINK_BASE}/build-artifacts/build-viz/index.html`;
+ const depVizUrl = `https://api.github.com/repos/MetaMask/metamask-extension/actions/artifacts/${LAVAMOAT_BUILD_VIZ_ID}/zip`;
const depVizLink = `Build System`;
const moduleInitStatsBackgroundUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/initialisation/background/index.html`;
const moduleInitStatsBackgroundLink = `Background Module Init Stats`;