The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Publish npm packages with npm's provenance signer (#29345)
Charles Bochet62dda8142300
diff --git a/.github/workflows/publish-npm-packages.yaml b/.github/workflows/publish-npm-packages.yamlindex 8ccd27ebed4..4fe3b7dea0b 100644--- a/.github/workflows/publish-npm-packages.yaml+++ b/.github/workflows/publish-npm-packages.yaml@@ -150,11 +150,12 @@ jobs:- name: Stage validation packages without publishingif: env.STAGE_ONLY == 'true'run: |- # This test stages the SDK before it is publicly available to the CLI's release-readiness check.- jq 'del(.scripts.prepublish)' packages/twenty-cli/package.json > "$RUNNER_TEMP/twenty-cli-staging.json"- mv "$RUNNER_TEMP/twenty-cli-staging.json" packages/twenty-cli/package.json+ # This test stages the SDK before it is publicly available to the CLI's release-readiness check,+ # so the CLI's prepublish is skipped. Same pack and npm signer as the real publish below.for package in $PACKAGES; do- yarn workspace "$package" npm publish --staged --provenance --tag "$DIST_TAG" --access public+ tarball="$RUNNER_TEMP/$package-$VERSION.tgz"+ yarn workspace "$package" pack --out "$tarball"+ npm stage publish "$tarball" --provenance --tag "$DIST_TAG" --access publicecho "Staged $package@$VERSION for OIDC validation only. Do not approve; reject after verification." >> "$GITHUB_STEP_SUMMARY"done@@ -180,19 +181,15 @@ jobs:if curl --fail --silent --show-error "https://registry.npmjs.org/$package/$VERSION" > /dev/null; thenecho "$package@$VERSION already published; skipping"else- for attempt in 1 2 3; do- publish_log=$(mktemp)- if yarn workspace "$package" npm publish --provenance --tag "$DIST_TAG" --access public 2>&1 | tee "$publish_log"; then- break- fi- # Yarn's Sigstore client times out on slow Rekor writes and its retry then hits a 409.- # Signing happens before the upload, so a failed attempt has published nothing.- if [[ "$attempt" == 3 ]] || ! grep -q "error creating tlog entry - (409)" "$publish_log"; then- exit 1- fi- echo "::warning::$package provenance entry conflicted in Rekor; retrying publish"- sleep 15- done+ # Yarn signs with a 5 s Sigstore timeout, so a slow Rekor write makes its retry hit a 409 on+ # the entry it just created. npm's signer waits up to fetch-timeout; Yarn still packs, to+ # resolve workspace: ranges, and pack skips prepublish, so the CLI's runs here.+ if [[ "$package" == twenty ]]; then+ yarn workspace twenty run prepublish+ fi+ tarball="$RUNNER_TEMP/$package-$VERSION.tgz"+ yarn workspace "$package" pack --out "$tarball"+ npm publish "$tarball" --provenance --tag "$DIST_TAG" --access publicfiif [[ "$package" != twenty ]]; thenpublished_libraries="$published_libraries $package"