Skip to content

Commit e12c798

Browse files
committed
chore: Allow release workflow to push changes
- Allow release workflow to push changes.
1 parent f196f0c commit e12c798

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed
File renamed without changes.

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish to Maven Central
33
on:
44
workflow_dispatch: # Manual trigger
55
release:
6-
types: [created] # Trigger when a new release is created
6+
types: [published]
77

88
jobs:
99
publish:

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ jobs:
2222

2323
- name: Update version in gradle.properties
2424
run: |
25+
# Ensure we have the latest code
26+
git fetch origin
27+
git checkout main
28+
29+
# Update version number
2530
sed -i '' "s/VERSION_NAME=.*/VERSION_NAME=${{ steps.get_version.outputs.VERSION }}/" gradle.properties
31+
32+
# Commit and push changes
2633
git config --local user.email "action@github.com"
2734
git config --local user.name "GitHub Action"
2835
git commit -m "Update version to ${{ steps.get_version.outputs.VERSION }}" -a || echo "No changes to commit"
36+
git push origin HEAD:main
2937
3038
- name: Create Release
3139
uses: softprops/action-gh-release@v2
@@ -35,3 +43,21 @@ jobs:
3543
Release version ${{ steps.get_version.outputs.VERSION }}
3644
draft: false
3745
prerelease: false
46+
47+
# - name: Update to next development version
48+
# run: |
49+
# # Calculate next version number
50+
# CURRENT_VERSION="${{ steps.get_version.outputs.VERSION }}"
51+
# # Split version number
52+
# IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
53+
# PATCH=$((VERSION_PARTS[2] + 1))
54+
# NEXT_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$PATCH-SNAPSHOT"
55+
56+
# # Update to next development version
57+
# sed -i '' "s/VERSION_NAME=.*/VERSION_NAME=$NEXT_VERSION/" gradle.properties
58+
59+
# # Commit and push changes
60+
# git config --local user.email "action@github.com"
61+
# git config --local user.name "GitHub Action"
62+
# git commit -m "Prepare for next development version $NEXT_VERSION" -a || echo "No changes to commit"
63+
# git push origin HEAD:main

0 commit comments

Comments
 (0)