Skip to content

Commit 2dc1023

Browse files
authored
chore(publishing): version packages (#8105)
1 parent 65b4a8f commit 2dc1023

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.github/workflows/publish-packages.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,10 @@ jobs:
8181
8282
# Determine if the package has changed (or include all on manual trigger)
8383
if [ "$EVENT_NAME" == "workflow_dispatch" ] || ! git diff --quiet $COMMIT_SHA~1 $COMMIT_SHA -- "$pkg/"; then
84-
HAS_VERSION=$(jq 'has("version")' "$PKG_JSON")
85-
if [ "$HAS_VERSION" == "false" ]; then
86-
# Include packages without version field
84+
OLD_VERSION=$(git show $COMMIT_SHA~1:$PKG_JSON | jq -r '.version')
85+
NEW_VERSION=$(jq -r '.version' "$PKG_JSON")
86+
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
8787
CHANGED_PACKAGES+=("$PKG_NAME")
88-
else
89-
# For packages with version field, include only if version changed
90-
OLD_VERSION=$(git show $COMMIT_SHA~1:$PKG_JSON | jq -r '.version')
91-
NEW_VERSION=$(jq -r '.version' "$PKG_JSON")
92-
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
93-
CHANGED_PACKAGES+=("$PKG_NAME")
94-
fi
9588
fi
9689
fi
9790
done
@@ -138,12 +131,6 @@ jobs:
138131
# Install deps
139132
pnpm install --frozen-lockfile
140133
141-
HAS_VERSION=$(jq 'has("version")' package.json)
142-
if [ "$HAS_VERSION" == "false" ]; then
143-
# Only bump version if package has no version field
144-
npm version --no-git-tag-version 1.0.1-$COMMIT_SHA
145-
fi
146-
147134
# Check if a custom publish script exists in package.json
148135
if jq -e '.scripts.publish' package.json > /dev/null; then
149136
pnpm run publish

.github/workflows/translations-sync.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
with:
7676
ref: ${{ env.BRANCH_NAME }}
7777
token: ${{ secrets.CROWDIN_GITHUB_BOT_TOKEN }}
78+
fetch-depth: 2
7879

7980
- name: Restore Lint Cache
8081
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -112,6 +113,14 @@ jobs:
112113
- name: Run Prettier
113114
run: node --run prettier:fix
114115

116+
- name: Patch version if the files changed
117+
run: |
118+
CHANGED_FILES=$(git diff --name-only origin/main HEAD -- packages/website-i18n)
119+
if [ -n "$CHANGED_FILES" ]; then
120+
cd packages/website-i18n
121+
pnpm version patch --no-git-tag-version
122+
else
123+
115124
- name: Push Changes back to Pull Request
116125
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
117126
with:

packages/i18n/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@node-core/website-i18n",
3+
"version": "1.1.0",
34
"type": "module",
45
"exports": {
56
"./*": [

packages/rehype-shiki/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@node-core/rehype-shiki",
3+
"version": "1.1.0",
34
"type": "module",
45
"exports": {
56
".": "./src/index.mjs",

packages/ui-components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@node-core/ui-components",
3+
"version": "1.1.0",
34
"type": "module",
45
"exports": {
56
"./*": [

0 commit comments

Comments
 (0)