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