|
69 | 69 | - name: Build |
70 | 70 | run: pnpm build |
71 | 71 |
|
72 | | - - name: Check for mobile-only commits |
73 | | - id: check_commits |
74 | | - run: | |
75 | | - # Get commits since last tag |
76 | | - LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") |
77 | | - if [ -z "$LAST_TAG" ]; then |
78 | | - COMMITS=$(git log --pretty=format:"%s") |
79 | | - else |
80 | | - COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s") |
81 | | - fi |
82 | | -
|
83 | | - echo "Commits since last tag:" |
84 | | - echo "$COMMITS" |
85 | | -
|
86 | | - # Count mobile commits |
87 | | - HAS_MOBILE=$(echo "$COMMITS" | grep -E '\(mobile\)' | wc -l || echo "0") |
88 | | -
|
89 | | - # Count non-mobile commits (excluding [skip ci] and chore(release) commits) |
90 | | - HAS_NON_MOBILE=$(echo "$COMMITS" | grep -v -E '\(mobile\)' | grep -v -E '\[skip ci\]' | grep -v -E '^chore\(release\):' | grep -v -E '^chore\(mobile\):' | grep -E '.' | wc -l || echo "0") |
91 | | -
|
92 | | - echo "Mobile commits: $HAS_MOBILE" |
93 | | - echo "Non-mobile commits: $HAS_NON_MOBILE" |
94 | | -
|
95 | | - if [ "$HAS_MOBILE" -gt 0 ] && [ "$HAS_NON_MOBILE" -eq 0 ]; then |
96 | | - echo "skip_release=true" >> $GITHUB_OUTPUT |
97 | | - echo "✅ Mobile-only commits detected, skipping semantic-release" |
98 | | - else |
99 | | - echo "skip_release=false" >> $GITHUB_OUTPUT |
100 | | - echo "✅ Non-mobile commits detected, running semantic-release" |
101 | | - fi |
102 | | -
|
103 | | - - name: Bump mobile version only |
104 | | - if: steps.check_commits.outputs.skip_release == 'true' |
105 | | - run: | |
106 | | - node scripts/update-mobile-version.js |
107 | | - git config user.name "github-actions[bot]" |
108 | | - git config user.email "github-actions[bot]@users.noreply.github.com" |
109 | | - git add apps/mobile/v1/package.json apps/mobile/v1/app.json apps/mobile/v1/src/constants/version.ts |
110 | | - git diff --staged --quiet || git commit -m "chore(mobile): bump mobile app version [skip ci]" |
111 | | - git push |
112 | | -
|
113 | 72 | - name: Release |
114 | 73 | id: semantic |
115 | | - if: steps.check_commits.outputs.skip_release != 'true' |
116 | 74 | env: |
117 | 75 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
118 | 76 | run: npx semantic-release |
|
0 commit comments