-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from sinch/DEVEXP-510-store-sdk-information-w…
…ith-sources feat (SDK/Versioning): Store SDK related informations wihtin sources
- Loading branch information
Showing
6 changed files
with
95 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
public class VersionTemplating { | ||
|
||
static final String SDK_FILE_PATH = "client/src/main/com/sinch/sdk/SDK.java"; | ||
|
||
public static void main(String[] args) throws IOException { | ||
|
||
String versionValue = args[0]; | ||
|
||
Stream<String> lines = Files.lines(Paths.get(SDK_FILE_PATH)); | ||
String content = lines.collect(Collectors.joining("\n")); | ||
lines.close(); | ||
|
||
System.out.println( | ||
content.replaceAll("VERSION = \".*\"", String.format("VERSION = \"%s\"", versionValue))); | ||
System.out.println(""); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.sinch.sdk; | ||
|
||
public class SDK { | ||
|
||
public static final String NAME = "Sinch Java SDK"; | ||
public static final String VERSION = "1.3.0-dev"; | ||
public static final String AUXILIARY_FLAG = ""; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
|
||
if [ ! "${RELEASE_VERSION}" ]; then | ||
echo "Missing 'RELEASE_VERSION' env value" | ||
exit 1 | ||
fi | ||
|
||
if [ ! "${NEXT_VERSION}" ]; then | ||
echo "Missing 'NEXT_VERSION' env value" | ||
exit 1 | ||
fi | ||
|
||
if [ ! "${GITHUB_USERNAME}" ]; then | ||
echo "Missing 'GITHUB_USERNAME' env value" | ||
exit 1 | ||
fi | ||
|
||
if [ ! "${GITHUB_TOKEN}" ]; then | ||
echo "Missing 'GITHUB_TOKEN' env value" | ||
exit 1 | ||
fi | ||
|
||
SDKFILE_PATH="client/src/main/com/sinch/sdk/SDK.java" | ||
|
||
NEXT_VERSION_SNAPSHOT="${NEXT_VERSION}-SNAPSHOT" | ||
NEXT_VERSION_DEV="${NEXT_VERSION}-dev" | ||
|
||
# Create SDK.java file with version information | ||
SDK=$(java client/resources/SDKTemplate.java "$RELEASE_VERSION") && echo "$SDK" > "$SDKFILE_PATH" || exit 1 | ||
git add "$SDKFILE_PATH" && git commit -m "build (release): Bump version to $RELEASE_VERSION for sources" || exit 1 | ||
|
||
mvn --batch-mode -s settings.xml release:clean release:prepare \ | ||
-Dtag="v$RELEASE_VERSION" \ | ||
-DreleaseVersion="$RELEASE_VERSION" \ | ||
-DdevelopmentVersion="${NEXT_VERSION_SNAPSHOT}" \ | ||
-DscmReleaseCommitComment="[release] Set release & tag: $RELEASE_VERSION" \ | ||
-DscmDevelopmentCommitComment="[release] Set next version: ${NEXT_VERSION_SNAPSHOT}" || exit 1 | ||
|
||
mvn --batch-mode -s settings.xml release:perform \ | ||
-Dusername="${GITHUB_USERNAME}" \ | ||
-Dpassword="${GITHUB_TOKEN}" \ | ||
-DskipTests=true || exit 1 | ||
|
||
# Update SDK.java file with next version information | ||
SDK=$(java client/resources/SDKTemplate.java "$NEXT_VERSION_DEV") && echo "$SDK" > "$SDKFILE_PATH" || exit 1 | ||
git add "$SDKFILE_PATH" && git commit -m "build (release): Set next version to $NEXT_VERSION_DEV for sources" || exit 1 | ||
git push -u origin HEAD || exit 1 |