Skip to content

Commit da2c6a6

Browse files
authored
ci(repo): fix preflight artifact output and skip private packages (#7825)
1 parent 6f76e39 commit da2c6a6

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

.github/workflows/release-preflight.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737

3838
# 1) Validate changesets against base branch
3939
- name: Changeset status
40-
run: pnpm changeset status --output .changeset-status.json
40+
run: |
41+
mkdir -p .release-artifacts
42+
pnpm changeset status --output .release-artifacts/changeset-status.json
4143
4244
# 2) Build (same path as production releases)
4345
- name: Build
@@ -62,20 +64,32 @@ jobs:
6264
# 5) Simulate publish by packing all public packages
6365
- name: Pack public packages
6466
run: |
65-
mkdir -p .release-artifacts
66-
pnpm -r exec -- sh -c '
67-
if [ "$(node -p "Boolean(require(\"./package.json\").private)")" = "true" ]; then
68-
echo "Skipping private package: $(node -p "require(\"./package.json\").name")"
69-
else
70-
npm pack --json
71-
fi
72-
' > .release-artifacts/pack-output.json 2>&1
67+
node -e '
68+
const fs = require("fs");
69+
const path = require("path");
70+
const { execSync } = require("child_process");
71+
const dirs = fs.readdirSync("packages", { withFileTypes: true })
72+
.filter(d => d.isDirectory())
73+
.map(d => path.join("packages", d.name));
74+
const results = [];
75+
for (const dir of dirs) {
76+
const pkgPath = path.join(dir, "package.json");
77+
if (!fs.existsSync(pkgPath)) continue;
78+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
79+
if (pkg.private) {
80+
console.log("Skipping private package:", pkg.name);
81+
continue;
82+
}
83+
const out = execSync("npm pack --json", { cwd: dir, encoding: "utf8" });
84+
results.push(...JSON.parse(out));
85+
}
86+
fs.writeFileSync(".release-artifacts/pack-output.json", JSON.stringify(results, null, 2));
87+
console.log("Packed", results.length, "packages");
88+
'
7389
7490
- name: Upload preflight artifacts
7591
if: always()
7692
uses: actions/upload-artifact@v4
7793
with:
7894
name: release-preflight-artifacts
79-
path: |
80-
.changeset-status.json
81-
.release-artifacts/pack-output.json
95+
path: .release-artifacts/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ sessions.pem
9090
.verdaccio
9191

9292
# Release preflight
93-
.changeset-status.json
9493
.release-artifacts/
9594

9695
# Workflow Outputs

0 commit comments

Comments
 (0)