Skip to content

Commit b5644ab

Browse files
authored
Update release workflow to compute next PATCH tag
1 parent dc40738 commit b5644ab

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release Dev-Build
22

33
on:
44
push:
5-
branches: [ development ] # adjust if you want 'development' instead
5+
branches: [ development ]
66
workflow_dispatch:
77

88
permissions:
@@ -30,32 +30,35 @@ jobs:
3030
java-version: 21
3131
cache: maven
3232

33-
# Read current version from MyPet module (must come BEFORE the bump step)
33+
# Optional: read current version (kept for visibility / logs)
3434
- name: Read current version from MyPet module
3535
id: getver
3636
run: |
3737
ver=$(mvn -f modules/MyPet/pom.xml -q -DforceStdout help:evaluate -Dexpression=project.version)
3838
echo "version=$ver" >> "$GITHUB_OUTPUT"
3939
40-
# Bump PATCH version (uses the version read above)
41-
- name: Bump version (PATCH)
42-
id: bump
43-
uses: christian-draeger/increment-version@v1.0.2
44-
with:
45-
current-version: ${{ steps.getver.outputs.version }}
46-
version-fragment: patch
40+
# Compute next PATCH tag from existing repo tags, but DO NOT create the tag yet
41+
- name: Compute next tag (PATCH, dry-run)
42+
id: tag
43+
uses: anothrNick/github-tag-action@1.71.0
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
DEFAULT_BUMP: patch
47+
WITH_V: false # produce 1.2.3 (no leading v)
48+
RELEASE_BRANCHES: development
49+
DRY_RUN: true # important: only calculate, don't tag yet
4750

4851
- name: Update version in MyPet module
4952
run: |
50-
mvn -f modules/MyPet versions:set -DnewVersion=${{ steps.bump.outputs.next-version }} -DgenerateBackupPoms=false
53+
mvn -f modules/MyPet versions:set -DnewVersion=${{ steps.tag.outputs.new_tag }} -DgenerateBackupPoms=false
5154
5255
- name: Commit bumped version and tag
5356
run: |
54-
git config user.name "github-actions[bot]"
57+
git config user.name "github-actions[bot]"
5558
git config user.email "github-actions[bot]@users.noreply.github.com"
5659
git add modules/MyPet/pom.xml
57-
git commit -m "chore(release): bump version to ${{ steps.bump.outputs.next-version }}" || echo "No changes to commit"
58-
git tag -a ${{ steps.bump.outputs.next-version }} -m "Release ${{ steps.bump.outputs.next-version }}"
60+
git commit -m "chore(release): bump version to ${{ steps.tag.outputs.new_tag }}" || echo "No changes to commit"
61+
git tag -a ${{ steps.tag.outputs.new_tag }} -m "Release ${{ steps.tag.outputs.new_tag }}"
5962
git push origin HEAD --tags
6063
6164
# Build using your previous compile flags
@@ -68,8 +71,8 @@ jobs:
6871
- name: Create GitHub Release
6972
uses: softprops/action-gh-release@v2
7073
with:
71-
tag_name: ${{ steps.bump.outputs.next-version }}
72-
name: v${{ steps.bump.outputs.next-version }}
74+
tag_name: ${{ steps.tag.outputs.new_tag }}
75+
name: v${{ steps.tag.outputs.new_tag }}
7376
files: |
7477
modules/MyPet/target/*.jar
7578
env:

0 commit comments

Comments
 (0)