Update antora on next development version release

Move commit from gradle task to workflow. Update antora.yml after project version update and before commit.

Closes gh-11021
This commit is contained in:
Eleftheria Stein 2022-03-29 12:25:55 +02:00
parent 4a25264404
commit 992b8c38ac
3 changed files with 4 additions and 24 deletions

View File

@ -263,7 +263,9 @@ jobs:
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
echo "Updating $REPO@$VERSION to next snapshot version."
./gradlew updateToSnapshotVersion -Pcommit=true
./gradlew :updateToSnapshotVersion
./gradlew :spring-security-docs:antoraUpdateVersion
git commit -am "Next development version"
git push
notify_result:
name: Check for failures

View File

@ -37,8 +37,7 @@ public class UpdateProjectVersionPlugin implements Plugin<Project> {
public void execute(UpdateToSnapshotVersionTask updateToSnapshotVersionTask) {
updateToSnapshotVersionTask.setGroup("Release");
updateToSnapshotVersionTask.setDescription(
"Updates the project version to the next snapshot in gradle.properties and optionally commits the changes");
updateToSnapshotVersionTask.setCommit("true".equals(project.findProperty("commit")));
"Updates the project version to the next snapshot in gradle.properties");
}
});
}

View File

@ -18,12 +18,9 @@ package org.springframework.security.convention.versions;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -31,10 +28,6 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask {
private static final String RELEASE_VERSION_PATTERN = "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-M\\d+|-RC\\d+)?$";
@Input
@Optional
private Boolean commit;
@TaskAction
public void updateToSnapshotVersion() {
String currentVersion = getProject().getVersion().toString();
@ -49,12 +42,6 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask {
gradlePropertiesText = gradlePropertiesText.replace("version=" + currentVersion, "version=" + nextVersion);
return gradlePropertiesText;
});
if (this.commit) {
System.out.println("Committing the version update");
File rootDir = getProject().getRootDir();
String commitMessage = "Next development version";
CommandLineUtils.runCommand(rootDir, "git", "commit", "-am", commitMessage);
}
}
private String calculateNextSnapshotVersion(String currentVersion) {
@ -78,12 +65,4 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask {
}
}
public Boolean getCommit() {
return commit;
}
public void setCommit(Boolean commit) {
this.commit = commit;
}
}