|
64 | 64 | actions: write |
65 | 65 | id-token: write |
66 | 66 | outputs: |
67 | | - committed: ${{ steps.commit-version-bump.outputs.committed }} |
68 | | - commit-sha: ${{ steps.commit-version-bump.outputs.commit-sha }} |
| 67 | + committed: ${{ steps.version-bump-outputs.outputs.committed }} |
| 68 | + commit-sha: ${{ steps.version-bump-outputs.outputs.commit-sha }} |
69 | 69 | env: |
70 | 70 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
71 | 71 | DOTNET_NOLOGO: true |
@@ -147,18 +147,38 @@ jobs: |
147 | 147 | - name: Test |
148 | 148 | run: dotnet test --configuration Release --no-build |
149 | 149 |
|
150 | | - - name: Commit version bump |
151 | | - id: commit-version-bump |
| 150 | + - name: Check for version bump changes |
| 151 | + id: check-changes |
152 | 152 | run: | |
153 | | - git add -A |
154 | | - if git diff --staged --quiet; then |
| 153 | + if [ -z "$(git status --porcelain)" ]; then |
155 | 154 | echo "No changes to commit" |
156 | | - echo "committed=false" >> "$GITHUB_OUTPUT" |
157 | | - echo "commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
| 155 | + echo "has-changes=false" >> "$GITHUB_OUTPUT" |
158 | 156 | else |
159 | | - git commit -m "chore: update package versions [version bump] [skip ci]" |
160 | | - git push origin main |
| 157 | + echo "has-changes=true" >> "$GITHUB_OUTPUT" |
| 158 | + fi |
| 159 | +
|
| 160 | + - name: Commit version bump |
| 161 | + id: commit-version-bump |
| 162 | + if: steps.check-changes.outputs.has-changes == 'true' |
| 163 | + uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20 |
| 164 | + with: |
| 165 | + commit_message: "chore: update package versions [version bump] [skip ci]" |
| 166 | + repo: ${{ github.repository }} |
| 167 | + branch: main |
| 168 | + env: |
| 169 | + GITHUB_TOKEN: ${{ steps.releaser.outputs.token }} |
| 170 | + |
| 171 | + - name: Set version bump outputs |
| 172 | + id: version-bump-outputs |
| 173 | + env: |
| 174 | + HAS_CHANGES: ${{ steps.check-changes.outputs.has-changes }} |
| 175 | + COMMIT_HASH: ${{ steps.commit-version-bump.outputs.commit-hash }} |
| 176 | + run: | |
| 177 | + if [ "$HAS_CHANGES" = "true" ]; then |
161 | 178 | echo "committed=true" >> "$GITHUB_OUTPUT" |
| 179 | + echo "commit-sha=$COMMIT_HASH" >> "$GITHUB_OUTPUT" |
| 180 | + else |
| 181 | + echo "committed=false" >> "$GITHUB_OUTPUT" |
162 | 182 | echo "commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
163 | 183 | fi |
164 | 184 |
|
|
0 commit comments