Skip to content

Commit bbff324

Browse files
committed
fix(ci): exclude node_modules from release artifact to avoid OOM
The release/publish workflow's build job uploads the entire workspace as an artifact for the publish job to download. With node_modules and build caches included, this monorepo produces ~6.4M files, which OOMs upload-artifact's Node process at its 4GB heap limit during enumeration: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory Excluding node_modules, .next, .turbo, and .nx cuts the file count by orders of magnitude. The publish job runs `pnpm install --frozen-lockfile` after download to restore node_modules deterministically from pnpm-lock.yaml (carried in the artifact), so the publish step still runs against exactly the resolved dependency tree the build job used. Fixes the upload step that hung for 12+ minutes and then OOM'd when the workflow_dispatch trigger added in CopilotKit#4808 was first exercised.
1 parent be0c400 commit bbff324

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/publish-release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,21 @@ jobs:
9191
- name: Build packages
9292
run: pnpm run build
9393

94+
# Exclude node_modules and build caches from the artifact. Including
95+
# them produces ~6.4M files for this monorepo, which OOMs
96+
# upload-artifact's Node process at its 4GB heap limit during
97+
# enumeration. The publish job runs `pnpm install` after download to
98+
# restore node_modules from pnpm-lock.yaml.
9499
- name: Upload workspace
95100
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
96101
with:
97102
name: workspace
98-
path: .
103+
path: |
104+
.
105+
!**/node_modules/**
106+
!**/.next/**
107+
!**/.turbo/**
108+
!**/.nx/**
99109
include-hidden-files: true
100110
retention-days: 1
101111

@@ -132,6 +142,13 @@ jobs:
132142
env:
133143
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
134144

145+
# Restore node_modules — the build job excludes them from the
146+
# uploaded workspace artifact (see "Upload workspace" above). Uses
147+
# pnpm-lock.yaml from the artifact, so this is a deterministic
148+
# restore of exactly what the build job ran with.
149+
- name: Install Dependencies
150+
run: pnpm install --frozen-lockfile
151+
135152
- name: Configure npm auth
136153
run: |
137154
npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"

0 commit comments

Comments
 (0)