Skip to content

Commit aa72a52

Browse files
authored
chore: add dry-run before publishing to avoid mistakes (#5183)
1 parent 9651734 commit aa72a52

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

scripts/github/publish-npm.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,24 @@ for (const REGISTRY of registries) {
8787
process.exit(1);
8888
}
8989

90-
for (const PACKAGE of packages) {
91-
console.log(`⤴ Publish ${PACKAGE} with tag ${TAG} to ${REGISTRY}`);
92-
execSync(
93-
`npm publish --tag ${TAG} db-ux-${PACKAGE}-${VALID_SEMVER_VERSION}.tgz --provenance`
94-
);
90+
// We do a try-run to check if everything is alright
91+
92+
for (const step of ['dry-run', 'provenance']) {
93+
for (const PACKAGE of packages) {
94+
console.log(
95+
`⤴ (${step}) Publish ${PACKAGE} with tag ${TAG} to ${REGISTRY}`
96+
);
97+
try {
98+
execSync(
99+
`npm publish --tag ${TAG} db-ux-${PACKAGE}-${VALID_SEMVER_VERSION}.tgz --${step}`
100+
);
101+
} catch (error) {
102+
console.error(
103+
`❌ ${step} publish failed for ${PACKAGE} with tag ${TAG} to ${REGISTRY}`
104+
);
105+
console.error(error.message || error);
106+
process.exit(1);
107+
}
108+
}
95109
}
96110
}

0 commit comments

Comments
 (0)