From a62d4181ee2bbeb51193655d6b64787487a5c396 Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Sun, 22 Mar 2026 04:40:27 +0000 Subject: [PATCH 1/2] ci: add pnpm detection to plugin-release workflow Mirrors the pnpm-detection logic from plugin-ci.yaml. When a repo has pnpm-lock.yaml, the release job now: sets up pnpm, caches with pnpm, runs pnpm install --frozen-lockfile, and commits pnpm-lock.yaml (not package-lock.json) in the release branch. Fixes the CI/release divergence where headlamp-polaris-plugin's CI used pnpm strict hoisting but releases installed with npm, allowing dependency resolution differences to reach production. Co-Authored-By: Paperclip --- .github/workflows/plugin-release.yaml | 36 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/plugin-release.yaml b/.github/workflows/plugin-release.yaml index 904cfae..56ccd1e 100644 --- a/.github/workflows/plugin-release.yaml +++ b/.github/workflows/plugin-release.yaml @@ -97,11 +97,29 @@ jobs: with: fetch-depth: 0 + - name: Detect package manager + id: pkg-manager + run: | + if [ -f "pnpm-lock.yaml" ]; then + echo "manager=pnpm" >> $GITHUB_OUTPUT + echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT + else + echo "manager=npm" >> $GITHUB_OUTPUT + echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT + fi + + - name: Setup pnpm + if: steps.pkg-manager.outputs.manager == 'pnpm' + uses: pnpm/action-setup@v4 + with: + run_install: false + version: latest + - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} - cache: 'npm' + cache: ${{ steps.pkg-manager.outputs.manager }} - name: Configure Git run: | @@ -110,7 +128,12 @@ jobs: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Update version in package.json - run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version + run: | + if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then + pnpm version ${{ inputs.version }} --no-git-tag-version --allow-same-version + else + npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version + fi - name: Update artifacthub-pkg.yml run: | @@ -132,7 +155,12 @@ jobs: fi - name: Install dependencies - run: npm ci + run: | + if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then + pnpm install --frozen-lockfile + else + npm ci + fi - name: Build plugin run: npx @kinvolk/headlamp-plugin build @@ -175,7 +203,7 @@ jobs: VERSION="${{ inputs.version }}" BRANCH="release/v${VERSION}" git checkout -b "$BRANCH" - git add package.json package-lock.json artifacthub-pkg.yml + git add package.json "${{ steps.pkg-manager.outputs.lockfile }}" artifacthub-pkg.yml git commit -m "release: v${VERSION}" git tag "v${VERSION}" git push origin "$BRANCH" --tags From ca5ab75f6b20ba62bb764ab6d2a519d6aecdff23 Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Sun, 22 Mar 2026 05:09:31 +0000 Subject: [PATCH 2/2] ci: remove version: latest from pnpm setup in plugin-release pnpm/action-setup@v4 errors with ERR_PNPM_BAD_PM_VERSION when both `version` (in the workflow) and `packageManager` (in package.json) are specified. Remove the hardcoded `version: latest` from plugin-release so that repos can pin their pnpm version via the packageManager field in package.json. When packageManager is absent the action falls back to latest (same prior behavior). When packageManager is set it is used exclusively, which prevents silent version drift. The plugin-ci.yaml change is handled separately in PR #54. Co-Authored-By: Paperclip --- .github/workflows/plugin-release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/plugin-release.yaml b/.github/workflows/plugin-release.yaml index 56ccd1e..c0b32c8 100644 --- a/.github/workflows/plugin-release.yaml +++ b/.github/workflows/plugin-release.yaml @@ -113,7 +113,6 @@ jobs: uses: pnpm/action-setup@v4 with: run_install: false - version: latest - name: Setup Node uses: actions/setup-node@v4