File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 with :
2626 fetch-tags : true
2727 - name : " Validate version tag doesn't exist"
28- run : |
29- VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
30- TAG="v${VERSION}"
31- REPO_URL="https://github.com/${{ github.repository }}"
32- if git ls-remote --tags "${REPO_URL}" | grep -q "refs/tags/${TAG}$"; then
33- echo "============================================="
34- echo "ERROR: Tag ${TAG} already exists!"
35- echo ""
36- echo "Please bump the version in gradle.properties"
37- echo "============================================="
38- exit 1
39- fi
40- echo "✓ Version ${VERSION} is valid (tag ${TAG} does not exist yet)"
28+ run : GRADLE_USER_HOME=$HOME/.gradle ./gradlew validateVersion --console=plain --no-daemon
4129 - name : " Gradle cache"
4230 uses : actions/cache@v4
4331 with :
Original file line number Diff line number Diff line change @@ -168,3 +168,21 @@ task tagRelease {
168168 }
169169 }
170170}
171+
172+ task validateVersion {
173+ doLast {
174+ def tagName = " v$version "
175+ def remoteTags = grgit. lsremote(tags : true ). keySet(). collect { it. toString() }
176+ def remoteHasTag = remoteTags. any { it. endsWith(" /${ tagName} " ) || it == tagName }
177+ if (remoteHasTag) {
178+ throw new GradleException ("""
179+ |=============================================
180+ | ERROR: Tag ${ tagName} already exists!
181+ |
182+ | Please bump the version in gradle.properties
183+ |=============================================
184+ """ . stripMargin())
185+ }
186+ logger. lifecycle(" ✓ Version ${ version} is valid (tag ${ tagName} does not exist yet)" )
187+ }
188+ }
Original file line number Diff line number Diff line change 1- version =1.35.8-2
1+ version =1.35.8-1
22org.gradle.jvmargs =-Xmx2g -XX:MaxMetaspaceSize =512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding =UTF-8
You can’t perform that action at this time.
0 commit comments