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 <noreply@paperclip.ing>
This commit is contained in:
@@ -97,11 +97,29 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
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
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node-version }}
|
node-version: ${{ inputs.node-version }}
|
||||||
cache: 'npm'
|
cache: ${{ steps.pkg-manager.outputs.manager }}
|
||||||
|
|
||||||
- name: Configure Git
|
- name: Configure Git
|
||||||
run: |
|
run: |
|
||||||
@@ -110,7 +128,12 @@ jobs:
|
|||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
- name: Update version in package.json
|
- 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
|
- name: Update artifacthub-pkg.yml
|
||||||
run: |
|
run: |
|
||||||
@@ -132,7 +155,12 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Install dependencies
|
- 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
|
- name: Build plugin
|
||||||
run: npx @kinvolk/headlamp-plugin build
|
run: npx @kinvolk/headlamp-plugin build
|
||||||
@@ -175,7 +203,7 @@ jobs:
|
|||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
BRANCH="release/v${VERSION}"
|
BRANCH="release/v${VERSION}"
|
||||||
git checkout -b "$BRANCH"
|
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 commit -m "release: v${VERSION}"
|
||||||
git tag "v${VERSION}"
|
git tag "v${VERSION}"
|
||||||
git push origin "$BRANCH" --tags
|
git push origin "$BRANCH" --tags
|
||||||
|
|||||||
Reference in New Issue
Block a user