Merge pull request #281 from ryanjbaxter/publish-antora-docs
Use command from properties
This commit is contained in:
@@ -104,7 +104,7 @@ releaser:
|
||||
antora:
|
||||
spring-docs-actions-url: https://github.com/ryanjbaxter/spring-doc-actions
|
||||
spring-docs-actions-tag: v0.0.16
|
||||
sync-antora-docs-command: "./action.sh"
|
||||
sync-antora-docs-command: "./jenkins.sh --docs-username {{ssh-username}} --docs-ssh-key-path {{ssh-key-path}} --docs-host docs-ip.spring.io --docs-ssh-host-key {{host-key}} --site-path {{site-path}} --github-repository {{github-repo}}"
|
||||
meta-release:
|
||||
enabled: false
|
||||
release-train-project-name: spring-cloud-release
|
||||
|
||||
@@ -520,15 +520,12 @@ public class ReleaserProperties implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Antora{" +
|
||||
"springDocsActionsUrl='" + springDocsActionsUrl + '\'' +
|
||||
", syncAntoraDocsCommand='" + syncAntoraDocsCommand + '\'' +
|
||||
", springDocsActionsTag='" + springDocsActionsTag + '\'' +
|
||||
", springDocsSshUsername='" + springDocsSshUsername + '\'' +
|
||||
", springDocsSshKey='" + springDocsSshKeyPath + '\'' +
|
||||
", springDocsSshHostKey='" + springDocsSshHostKey + '\'' +
|
||||
'}';
|
||||
return "Antora{" + "springDocsActionsUrl='" + springDocsActionsUrl + '\'' + ", syncAntoraDocsCommand='"
|
||||
+ syncAntoraDocsCommand + '\'' + ", springDocsActionsTag='" + springDocsActionsTag + '\''
|
||||
+ ", springDocsSshUsername='" + springDocsSshUsername + '\'' + ", springDocsSshKey='"
|
||||
+ springDocsSshKeyPath + '\'' + ", springDocsSshHostKey='" + springDocsSshHostKey + '\'' + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Git implements Serializable {
|
||||
|
||||
@@ -184,14 +184,10 @@ public class ProjectCommandExecutor {
|
||||
log.info("Executing command for publishing Antora docs " + command + " / " + properties);
|
||||
String[] commands = command.split(" ");
|
||||
// TODO fix this hack
|
||||
for (int i = 0; i < commands.length; i++) {
|
||||
if (commands[i].contains("{{cat-key}}")) {
|
||||
commands[i] = commands[i].replace("{{cat-key}}", "\"$(cat $DOCS_SERVER_SSH_KEY)\"");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < commands.length; i++) {
|
||||
if (commands[i].contains("{{host-key}}")) {
|
||||
commands[i] = commands[i].replace("{{host-key}}", "\"" + properties.getAntora().getSpringDocsSshHostKey()) + "\"";
|
||||
commands[i] = commands[i].replace("{{host-key}}",
|
||||
"\"" + properties.getAntora().getSpringDocsSshHostKey()) + "\"";
|
||||
}
|
||||
}
|
||||
runCommand(properties, antoraDocsProject.getAbsolutePath() + "/rsync-antora-reference/src", commands);
|
||||
@@ -346,10 +342,15 @@ class CommandPicker {
|
||||
String publishAntoraDocsCommand(File project, ReleaserProperties properties) {
|
||||
ProjectVersion version = new ProjectVersion(project);
|
||||
String repo = properties.getGit().getOrgName() + "/" + version.projectName;
|
||||
// TODO this needs to be a property
|
||||
return "./jenkins.sh --docs-username " + properties.getAntora().getSpringDocsSshUsername() + " --docs-ssh-key-path " + properties.getAntora().getSpringDocsSshKeyPath()
|
||||
+ " --docs-host docs-ip.spring.io --docs-ssh-host-key {{host-key}} --site-path "
|
||||
+ project.getAbsolutePath() + "/target/antora/site --github-repository " + repo + " --dry-run";
|
||||
String command = properties.getAntora().getSyncAntoraDocsCommand().replace("{{github-repo}}", repo)
|
||||
.replace("{{site-path}}", project.getAbsolutePath() + "/target/antora/site");
|
||||
if (StringUtils.hasText(properties.getAntora().getSpringDocsSshUsername())) {
|
||||
command = command.replace("{{ssh-username}}", properties.getAntora().getSpringDocsSshUsername());
|
||||
}
|
||||
if (StringUtils.hasText(properties.getAntora().getSpringDocsSshKeyPath())) {
|
||||
command = command.replace("{{ssh-key-path}}", properties.getAntora().getSpringDocsSshKeyPath());
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
String version() {
|
||||
|
||||
Reference in New Issue
Block a user