Skip to content

Commit 18c3a84

Browse files
authored
chore: sign release version bump commits (#195)
1 parent 188e99a commit 18c3a84

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ jobs:
6464
actions: write
6565
id-token: write
6666
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 }}
6969
env:
7070
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
7171
DOTNET_NOLOGO: true
@@ -147,18 +147,38 @@ jobs:
147147
- name: Test
148148
run: dotnet test --configuration Release --no-build
149149

150-
- name: Commit version bump
151-
id: commit-version-bump
150+
- name: Check for version bump changes
151+
id: check-changes
152152
run: |
153-
git add -A
154-
if git diff --staged --quiet; then
153+
if [ -z "$(git status --porcelain)" ]; then
155154
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"
158156
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
161178
echo "committed=true" >> "$GITHUB_OUTPUT"
179+
echo "commit-sha=$COMMIT_HASH" >> "$GITHUB_OUTPUT"
180+
else
181+
echo "committed=false" >> "$GITHUB_OUTPUT"
162182
echo "commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
163183
fi
164184

0 commit comments

Comments
 (0)