diff --git a/projects/spring-cloud/src/main/resources/application.yml b/projects/spring-cloud/src/main/resources/application.yml index c90bb283..8ac51437 100644 --- a/projects/spring-cloud/src/main/resources/application.yml +++ b/projects/spring-cloud/src/main/resources/application.yml @@ -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 diff --git a/releaser-core/src/main/java/releaser/internal/ReleaserProperties.java b/releaser-core/src/main/java/releaser/internal/ReleaserProperties.java index b0abd2ae..9a33fbce 100644 --- a/releaser-core/src/main/java/releaser/internal/ReleaserProperties.java +++ b/releaser-core/src/main/java/releaser/internal/ReleaserProperties.java @@ -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 { diff --git a/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java b/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java index 4c4317cc..40f2fbcc 100644 --- a/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java +++ b/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java @@ -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() {