@@ -46,6 +46,7 @@ public void execute() {
4646
4747 updateNextVersion (gradlePropertiesFile , properties , newVersion );
4848 updateChangelog (currentVersion );
49+ updateSetupDoc (currentVersion );
4950
5051 createPullRequestWithChanges (currentVersion );
5152 setGitHubRelease (currentVersion , releaseTag );
@@ -85,12 +86,23 @@ private void updateNextVersion(File gradlePropertiesFile, Properties properties,
8586
8687 private void updateChangelog (String newVersion ) {
8788 log ("Updating changelog with version: " + newVersion );
88- Path changelogPath = getChangelogPath ( );
89+ Path changelogPath = getProjectPath ( "CHANGELOG.asciidoc" );
8990 String contents = getContents (changelogPath );
9091 contents = uncommentNextRelease (contents );
9192 replaceFileContents (changelogPath , resolvePlaceholders (contents , newVersion ));
9293 }
9394
95+ private void updateSetupDoc (String currentVersion ) {
96+ log ("Updating setup doc to show version: " + currentVersion );
97+ Path setupDocPath = getProjectPath ("docs/setup.asciidoc" );
98+ String contents = getContents (setupDocPath );
99+ Pattern versionMentionsPattern = Pattern .compile ("(?<=co\\ .elastic\\ .apm\\ .android/)\\ d+\\ .\\ d+\\ .\\ d+|(?<=co\\ .elastic\\ .apm:android-sdk:)\\ d+\\ .\\ d+\\ .\\ d+|(?<=id\\ s\" co\\ .elastic\\ .apm\\ .android\" \\ sversion\\ s\" )\\ d+\\ .\\ d+\\ .\\ d+" );
100+ Matcher versionMentionMatcher = versionMentionsPattern .matcher (contents );
101+
102+ String setupDocWithNewVersion = versionMentionMatcher .replaceAll (currentVersion );
103+ replaceFileContents (setupDocPath , setupDocWithNewVersion .getBytes (StandardCharsets .UTF_8 ));
104+ }
105+
94106 private byte [] resolvePlaceholders (String text , String newVersion ) {
95107 Map <String , String > substitutions = new HashMap <>();
96108 substitutions .put ("release_date" , new SimpleDateFormat ("yyyy/MM/dd" , Locale .US ).format (new Date ()));
@@ -100,8 +112,8 @@ private byte[] resolvePlaceholders(String text, String newVersion) {
100112 return substitutor .replace (text ).getBytes (StandardCharsets .UTF_8 );
101113 }
102114
103- private Path getChangelogPath ( ) {
104- File changelog = new File ("CHANGELOG.asciidoc" );
115+ private Path getProjectPath ( String relativePath ) {
116+ File changelog = new File (relativePath );
105117 return changelog .toPath ();
106118 }
107119
0 commit comments