From b0c630da75fafd21b51d677644710b9aea7442c5 Mon Sep 17 00:00:00 2001 From: avivkeller Date: Fri, 22 Aug 2025 17:51:05 -0400 Subject: [PATCH] chore(publishing): version packages --- .github/workflows/publish-packages.yml | 19 +++---------------- .github/workflows/translations-sync.yml | 9 +++++++++ packages/i18n/package.json | 1 + packages/rehype-shiki/package.json | 1 + packages/ui-components/package.json | 1 + 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 6c6f7e32a7f28..05471fdf28f56 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -81,17 +81,10 @@ jobs: # Determine if the package has changed (or include all on manual trigger) if [ "$EVENT_NAME" == "workflow_dispatch" ] || ! git diff --quiet $COMMIT_SHA~1 $COMMIT_SHA -- "$pkg/"; then - HAS_VERSION=$(jq 'has("version")' "$PKG_JSON") - if [ "$HAS_VERSION" == "false" ]; then - # Include packages without version field + OLD_VERSION=$(git show $COMMIT_SHA~1:$PKG_JSON | jq -r '.version') + NEW_VERSION=$(jq -r '.version' "$PKG_JSON") + if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then CHANGED_PACKAGES+=("$PKG_NAME") - else - # For packages with version field, include only if version changed - OLD_VERSION=$(git show $COMMIT_SHA~1:$PKG_JSON | jq -r '.version') - NEW_VERSION=$(jq -r '.version' "$PKG_JSON") - if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then - CHANGED_PACKAGES+=("$PKG_NAME") - fi fi fi done @@ -138,12 +131,6 @@ jobs: # Install deps pnpm install --frozen-lockfile - HAS_VERSION=$(jq 'has("version")' package.json) - if [ "$HAS_VERSION" == "false" ]; then - # Only bump version if package has no version field - npm version --no-git-tag-version 1.0.1-$COMMIT_SHA - fi - # Check if a custom publish script exists in package.json if jq -e '.scripts.publish' package.json > /dev/null; then pnpm run publish diff --git a/.github/workflows/translations-sync.yml b/.github/workflows/translations-sync.yml index b58f40ccfff71..9fde25a2163d3 100644 --- a/.github/workflows/translations-sync.yml +++ b/.github/workflows/translations-sync.yml @@ -75,6 +75,7 @@ jobs: with: ref: ${{ env.BRANCH_NAME }} token: ${{ secrets.CROWDIN_GITHUB_BOT_TOKEN }} + fetch-depth: 2 - name: Restore Lint Cache uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 @@ -112,6 +113,14 @@ jobs: - name: Run Prettier run: node --run prettier:fix + - name: Patch version if the files changed + run: | + CHANGED_FILES=$(git diff --name-only origin/main HEAD -- packages/website-i18n) + if [ -n "$CHANGED_FILES" ]; then + cd packages/website-i18n + pnpm version patch --no-git-tag-version + else + - name: Push Changes back to Pull Request uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1 with: diff --git a/packages/i18n/package.json b/packages/i18n/package.json index e99deeabdaf7f..14f69c06c3b61 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,5 +1,6 @@ { "name": "@node-core/website-i18n", + "version": "1.1.0", "type": "module", "exports": { "./*": [ diff --git a/packages/rehype-shiki/package.json b/packages/rehype-shiki/package.json index 62edd03c52ae2..5885096e92ada 100644 --- a/packages/rehype-shiki/package.json +++ b/packages/rehype-shiki/package.json @@ -1,5 +1,6 @@ { "name": "@node-core/rehype-shiki", + "version": "1.1.0", "type": "module", "exports": { ".": "./src/index.mjs", diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index 4267399460f16..7ef6048a5e078 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -1,5 +1,6 @@ { "name": "@node-core/ui-components", + "version": "1.1.0", "type": "module", "exports": { "./*": [