From bcb2da8970470b81117a60891f00f93a782c7dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Fri, 19 Jun 2026 11:05:30 +0200 Subject: [PATCH] fix(ci): repair theme publish version bump and commit-back The publish-theme workflow was failing at "Bump the theme version" with ERR_PNPM_UNCLEAN_WORKING_TREE. Root cause: the "Commit the new theme version" step has been silently failing since the repo migrated to pnpm because it tried to `git add` apify-docs-theme/package-lock.json, which doesn't exist in a pnpm repo (it's pnpm-lock.yaml). With continue-on-error: true, the job stayed green while the bumped version was never committed back, so the repo's package.json drifted behind npm (1.0.248 vs 1.0.251). `pnpm pkg set version=$LATEST` then writes a diff, dirtying the tree, and `pnpm version patch` refuses to run on a dirty tree. Fixes: - Compute the next patch version with `semver -i patch` and write it via `pnpm pkg set`, avoiding pnpm's clean-tree check entirely so the bump is robust even if the committed version drifts. - Drop the non-existent package-lock.json from the commit-back `add` list and remove continue-on-error so this never silently breaks again. - Re-sync the committed theme version (1.0.251) with npm latest. --- .github/workflows/publish-to-npm.yaml | 10 ++++++---- apify-docs-theme/package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-to-npm.yaml b/.github/workflows/publish-to-npm.yaml index 3738328779..27dad7c115 100644 --- a/.github/workflows/publish-to-npm.yaml +++ b/.github/workflows/publish-to-npm.yaml @@ -65,8 +65,11 @@ jobs: cd "$GITHUB_WORKSPACE/apify-docs-theme" PACKAGE_NAME=$(jq -r .name package.json) LATEST_VERSION=$(pnpm show "$PACKAGE_NAME" version 2>/dev/null || jq -r .version package.json) - pnpm pkg set "version=$LATEST_VERSION" - pnpm version patch --no-git-tag-version + # Compute the next patch version from the latest published one and write it directly. + # Avoid `pnpm version patch`, which refuses to run when the working tree is dirty + # (it becomes dirty whenever the committed version has drifted behind npm). + NEXT_VERSION=$(npx --yes semver -i patch "$LATEST_VERSION") + pnpm pkg set "version=$NEXT_VERSION" - name: Deploy theme to npm run: | @@ -92,11 +95,10 @@ jobs: pnpm show "$PACKAGE_NAME@$PACKAGE_VER" # fails if the package is not available, succeeds if it is - name: Commit the new theme version - continue-on-error: true uses: apify/actions/signed-commit@v1.0.0 with: message: 'chore: publish new version of @apify/docs-theme [skip ci]' - add: 'apify-docs-theme/package.json apify-docs-theme/package-lock.json' + add: 'apify-docs-theme/package.json' pull: '--rebase --autostash' github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} diff --git a/apify-docs-theme/package.json b/apify-docs-theme/package.json index 62334e494c..d5275261ac 100644 --- a/apify-docs-theme/package.json +++ b/apify-docs-theme/package.json @@ -1,6 +1,6 @@ { "name": "@apify/docs-theme", - "version": "1.0.248", + "version": "1.0.251", "description": "", "main": "./src/index.js", "files": [