Skip to content

Commit d4fe6d2

Browse files
committed
feat: last try
1 parent d789734 commit d4fe6d2

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

.github/workflows/ci-cd.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -144,36 +144,49 @@ jobs:
144144
run: |
145145
echo "🔍 Checking for changes requiring versioning..."
146146
147-
# Simple approach: check against origin/develop using --diff
148-
# This works for both first releases and merges
149-
CHANGED_PACKAGES=$(melos list --diff=origin/develop --json 2>/dev/null | jq -r '.[].name' | wc -l || echo "0")
150-
151-
# If no changes found, it might be because we're on develop or first commit
152-
if [ "$CHANGED_PACKAGES" -eq 0 ]; then
153-
echo "🔄 No changes since origin/develop, checking if this is a first release..."
154-
155-
# Check if we have any package tags
156-
PACKAGE_TAGS=$(git tag -l "*@*" | wc -l || echo "0")
157-
if [ "$PACKAGE_TAGS" -eq 0 ]; then
158-
echo "🎉 No package tags found - treating as first release"
159-
CHANGED_PACKAGES=$(melos list --no-private --json 2>/dev/null | jq -r '.[].name' | wc -l || echo "0")
147+
# Check if we have any package tags (first release detection)
148+
PACKAGE_TAGS=$(git tag -l "*@*" | wc -l || echo "0")
149+
echo "📌 Found $PACKAGE_TAGS existing package tags"
150+
151+
if [ "$PACKAGE_TAGS" -eq 0 ]; then
152+
echo "🎉 No package tags found - treating as first release"
153+
# For first release, count all public packages
154+
CHANGED_PACKAGES=$(melos list --no-private --parsable | wc -l || echo "0")
155+
echo "📦 First release: $CHANGED_PACKAGES public packages to publish"
156+
157+
if [ "$CHANGED_PACKAGES" -gt 0 ]; then
158+
echo "📋 Packages to publish:"
159+
melos list --no-private --long || echo "Unable to list packages"
160160
fi
161-
fi
161+
else
162+
echo "🔄 Checking for changes since origin/develop..."
163+
# For subsequent releases, use git to check for changes in package directories
164+
CHANGED_PACKAGES=0
162165
163-
echo "changed_packages=$CHANGED_PACKAGES" >> $GITHUB_OUTPUT
164-
echo "📦 Found $CHANGED_PACKAGES packages with changes"
165-
166-
# List changed packages for debugging
167-
if [ "$CHANGED_PACKAGES" -gt 0 ]; then
168-
echo "📋 Changed packages:"
169-
if [ "$PACKAGE_TAGS" -eq 0 ]; then
170-
echo "First release - all public packages:"
171-
melos list --no-private --long 2>/dev/null || echo "Unable to list packages"
166+
# Check each package directory for changes
167+
if git diff --quiet origin/develop HEAD -- packages/pillar-core/; then
168+
echo "📦 pillar-core: no changes"
172169
else
173-
melos list --diff=origin/develop --long 2>/dev/null || echo "Unable to list changed packages"
170+
echo "📦 pillar-core: has changes"
171+
CHANGED_PACKAGES=$((CHANGED_PACKAGES + 1))
174172
fi
173+
174+
if git diff --quiet origin/develop HEAD -- packages/pillar-remote-config/; then
175+
echo "📦 pillar-remote-config: no changes"
176+
else
177+
echo "📦 pillar-remote-config: has changes"
178+
# Only count if it's public (check pubspec.yaml)
179+
if ! grep -q "publish_to: none" packages/pillar-remote-config/pubspec.yaml 2>/dev/null; then
180+
CHANGED_PACKAGES=$((CHANGED_PACKAGES + 1))
181+
fi
182+
fi
183+
184+
echo "📦 Found $CHANGED_PACKAGES packages with changes"
175185
fi
176186
187+
echo "changed_packages=$CHANGED_PACKAGES" >> $GITHUB_OUTPUT
188+
echo "✅ Final result: $CHANGED_PACKAGES packages to process"
189+
177190
- name: 🔄 Version packages
178191
if: steps.check-changes.outputs.changed_packages > 0
179192
run: |

0 commit comments

Comments
 (0)