From 117d3335920bae8881a52566ad38672f5a0fc1d4 Mon Sep 17 00:00:00 2001 From: Jared Jolton Date: Wed, 18 Mar 2026 10:13:04 -0600 Subject: [PATCH] fix: restore GitHub Packages publishing for @contentful packages CI publish to GitHub Packages was silently failing because the project .npmrc (with @contentful:registry=https://registry.npmjs.org) overrides the CI-configured ~/.npmrc scope, causing lerna publish to target the wrong registry without auth. - Restore removal of project .npmrc during publish step (was in 4d728ad46, mistakenly removed in b8576a92e) - Remove silent error suppression on lerna publish from-git so publish failures are visible in CI - Add publishConfig to all publishable packages as defense-in-depth Made-with: Cursor --- .circleci/config.yml | 6 ++++++ package.json | 2 +- packages/dam-app-base/package.json | 4 ++++ packages/ecommerce-app-base/package.json | 4 ++++ packages/eslint-plugin-contentful-apps/package.json | 4 ++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d9e8295e7..f0a2e19ee7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,11 +13,17 @@ commands: - run: name: Setup GitHub packages command: | + if [ -f ./.npmrc ]; then mv ./.npmrc ./.npmrc.bak; fi echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_WRITE_TOKEN}" > ~/.npmrc echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc - run: name: Publish packages command: npm run publish-packages + - run: + name: Restore .npmrc + when: always + command: | + if [ -f ./.npmrc.bak ]; then mv ./.npmrc.bak ./.npmrc; fi set_since: steps: diff --git a/package.json b/package.json index 56862d3531..93a08f4268 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "deploy": "lerna run deploy --concurrency=3 --since=${SINCE:-master}", "deploy:test": "lerna run deploy:test --concurrency=3 --since=${SINCE:-master}", "post-deploy": "lerna run post-deploy", - "publish-packages": "lerna version --conventional-commits --no-private --force-git-tag --create-release github --yes && (lerna publish from-git --yes || echo 'Publish failed, continuing...')", + "publish-packages": "lerna version --conventional-commits --no-private --force-git-tag --create-release github --yes && lerna publish from-git --yes", "prettier:list": "npx prettier@2.8.8 --list-different", "prettier:write": "npx prettier@2.8.8 --write", "prettier:check": "npx prettier@2.8.8 --check '**/*.{js,jsx,ts,tsx}'", diff --git a/packages/dam-app-base/package.json b/packages/dam-app-base/package.json index 07d787f3f1..8287f388bc 100644 --- a/packages/dam-app-base/package.json +++ b/packages/dam-app-base/package.json @@ -14,6 +14,10 @@ "url": "https://github.com/contentful/apps.git", "directory": "packages/dam-app-base" }, + "publishConfig": { + "access": "public", + "registry": "https://npm.pkg.github.com/" + }, "devDependencies": { "@testing-library/react": "16.3.0", "@types/jest": "27.5.0", diff --git a/packages/ecommerce-app-base/package.json b/packages/ecommerce-app-base/package.json index c52c1823ba..3818c8da66 100644 --- a/packages/ecommerce-app-base/package.json +++ b/packages/ecommerce-app-base/package.json @@ -14,6 +14,10 @@ "url": "https://github.com/contentful/apps.git", "directory": "packages/ecommerce-app-base" }, + "publishConfig": { + "access": "public", + "registry": "https://npm.pkg.github.com/" + }, "devDependencies": { "@babel/preset-env": "^7.22.10", "@babel/preset-react": "^7.22.5", diff --git a/packages/eslint-plugin-contentful-apps/package.json b/packages/eslint-plugin-contentful-apps/package.json index 5bd4f1443f..268a4f15fe 100644 --- a/packages/eslint-plugin-contentful-apps/package.json +++ b/packages/eslint-plugin-contentful-apps/package.json @@ -16,6 +16,10 @@ "url": "https://github.com/contentful/apps.git", "directory": "packages/eslint-plugin-contentful-apps" }, + "publishConfig": { + "access": "public", + "registry": "https://npm.pkg.github.com/" + }, "author": "Contentful GmbH", "license": "MIT", "description": "Eslint plugin for Contentful App Framework Apps",