@@ -69,15 +69,23 @@ jobs:
6969 VERSION : ${{ steps.version.outputs.version }}
7070 run : |
7171 git add src/BitPaySDK/Env.php phpdoc.dist.xml
72- git commit -m "Bump version to $VERSION"
73- git push origin "$BRANCH"
72+ if git diff --cached --quiet; then
73+ echo "No changes to commit - version already bumped"
74+ else
75+ git commit -m "Bump version to $VERSION"
76+ git push origin "$BRANCH"
77+ fi
7478
7579 - name : Create and push tag
7680 env :
7781 VERSION : ${{ steps.version.outputs.version }}
7882 run : |
79- git tag "$VERSION"
80- git push origin "$VERSION"
83+ if git rev-parse "$VERSION" >/dev/null 2>&1; then
84+ echo "Tag $VERSION already exists"
85+ else
86+ git tag "$VERSION"
87+ git push origin "$VERSION"
88+ fi
8189
8290 - name : Get merged PR titles and format release notes
8391 id : changelog
@@ -86,13 +94,22 @@ jobs:
8694 OVERVIEW : ${{ inputs.overview }}
8795 BRANCH : ${{ inputs.branch }}
8896 REPOSITORY : ${{ github.repository }}
97+ VERSION : ${{ steps.version.outputs.version }}
8998 run : |
9099 git fetch --tags
91100
92- # Get most recent and previous tags
101+ # Get all tags sorted by creation date (newest first)
93102 tags=($(git tag --sort=-creatordate))
94- new_tag="${tags[0]}"
95- prev_tag="${tags[1]}"
103+
104+ # Find the current version tag and get the previous one
105+ new_tag="$VERSION"
106+ prev_tag=""
107+ for i in "${!tags[@]}"; do
108+ if [[ "${tags[$i]}" == "$VERSION" ]]; then
109+ prev_tag="${tags[$((i+1))]}"
110+ break
111+ fi
112+ done
96113
97114 if [ -z "$prev_tag" ]; then
98115 echo "Warning: No previous tag found. Skipping full changelog link."
0 commit comments