Skip to content

Commit

Permalink
Fix script tp update release version. (dapr#1153)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursouza authored Oct 23, 2024
1 parent b683fce commit 0b7a051
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 16 deletions.
14 changes: 11 additions & 3 deletions .github/scripts/update_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ set -uex

DAPR_JAVA_SDK_VERSION=$1

# Alpha artifacts of the sdk tracks the regular SDK minor and patch versions, just not the major.
# Replaces the SDK major version to 0 for alpha artifacts.
DAPR_JAVA_SDK_ALPHA_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./'`

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i bak "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_VERSION}<\/version>/g" README.md
sed -i bak "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" README.md
sed -i bak "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/_index.md
sed -i bak "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" daprdocs/content/en/java-sdk-docs/_index.md
sed -i bak "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_ALPHA_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/spring-boot/_index.md
rm README.mdbak
else
sed -i "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_VERSION}<\/version>/g" README.md
sed -i "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" README.md
sed -i "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/_index.md
sed -i "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" daprdocs/content/en/java-sdk-docs/_index.md
sed -i "s/<version>.*<\/version>\$/<version>${DAPR_JAVA_SDK_ALPHA_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/spring-boot/_index.md
fi

rm -rf docs
mvn -Dmaven.test.skip=false -Djacoco.skip=true clean install
mvn site-deploy
rm -f daprdocs/content/en/java-sdk-docs/_index.mdbak || echo
rm -f daprdocs/content/en/java-sdk-docs/spring-boot/_index.md/_index.mdbak || echo

rm -rf docs
./mvnw -Dmaven.test.skip=false -Djacoco.skip=true clean install
./mvnw site-deploy
4 changes: 4 additions & 0 deletions .github/scripts/update_sdk_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ DAPR_JAVA_SDK_ALPHA_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./'

mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_VERSION
mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION
mvn versions:set-property -Dproperty=dapr.sdk.version -DnewVersion=$DAPR_JAVA_SDK_VERSION
mvn versions:set-property -Dproperty=dapr.sdk.version -DnewVersion=$DAPR_JAVA_SDK_VERSION -f sdk-tests/pom.xml
mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-tests/pom.xml

Expand All @@ -23,4 +24,7 @@ mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-workflows/pom.
# testcontainers-dapr
mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f testcontainers-dapr/pom.xml

# dapr-spring
mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f dapr-spring/pom.xml

git clean -f
34 changes: 34 additions & 0 deletions .github/workflows/validate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validate Javadocs Generation

on:
workflow_dispatch:
push:
branches:
- master
- release-*
tags:
- v*

pull_request:
branches:
- master
- release-*

jobs:
build:
name: "Validate Javadocs generation"
runs-on: linux-arm64-latest-4-cores
timeout-minutes: 30
env:
JDK_VER: 17
steps:
- uses: actions/checkout@v4
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Install jars
run: ./mvnw install -q -B -DskipTests
- name: Validate Java docs generation
run: ./mvnw site-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private String createSql(String sqlPattern, String keyspace) {
private String createSql(String sqlPattern, String keyspace, Object criteria) {
String keyspaceFilter = getKeyspaceFilter(keyspace);

if (criteria instanceof DaprPredicate daprPredicate) {
if (criteria instanceof DaprPredicate) {
var daprPredicate = (DaprPredicate) criteria;
String path = daprPredicate.getPath().toString();
String pathWithOutType = String.format("'%s'", path.substring(path.indexOf(".") + 1));
String value = String.format("'%s'", daprPredicate.getValue().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public Predicate<Object> isFalse() {
public Predicate<Object> isEqualTo(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
if (o instanceof String s1 && value instanceof String s2) {
if ((o instanceof String) && (value instanceof String)) {
var s1 = (String)o;
var s2 = (String)value;
return s1.equalsIgnoreCase(s2);
}
}
Expand Down Expand Up @@ -85,7 +87,8 @@ public Predicate<Object> matches(Object value) {
return ObjectUtils.nullSafeEquals(o, value);
}

if (value instanceof Pattern pattern) {
if (value instanceof Pattern) {
var pattern = (Pattern)value;
return pattern.matcher(o.toString()).find();
}

Expand All @@ -95,8 +98,10 @@ public Predicate<Object> matches(Object value) {

public Predicate<Object> in(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (value instanceof Collection<?> collection) {
if (o instanceof Collection<?> subSet) {
if (value instanceof Collection<?>) {
var collection = (Collection<?>)value;
if (o instanceof Collection<?>) {
var subSet = (Collection<?>)o;
return collection.containsAll(subSet);
}

Expand All @@ -117,15 +122,17 @@ public Predicate<Object> contains(Object value) {
return false;
}

if (o instanceof Collection<?> collection) {
if (o instanceof Collection<?>) {
var collection = (Collection<?>)o;
return collection.contains(value);
}

if (ObjectUtils.isArray(o)) {
return ObjectUtils.containsElement(ObjectUtils.toObjectArray(o), value);
}

if (o instanceof Map<?, ?> map) {
if (o instanceof Map<?, ?>) {
var map = (Map<?, ?>)o;
return map.containsValue(value);
}

Expand All @@ -145,9 +152,10 @@ public Predicate<Object> contains(Object value) {

public Predicate<Object> startsWith(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!(o instanceof String s)) {
if (!(o instanceof String)) {
return false;
}
var s = (String)o;

if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
return s.startsWith(value.toString());
Expand All @@ -159,10 +167,11 @@ public Predicate<Object> startsWith(Object value) {

public Predicate<Object> endsWith(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!(o instanceof String s)) {
if (!(o instanceof String)) {
return false;
}

var s = (String)o;
if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
return s.endsWith(value.toString());
}
Expand Down
8 changes: 4 additions & 4 deletions dapr-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

<properties>
<springboot.version>3.2.6</springboot.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -108,7 +108,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down

0 comments on commit 0b7a051

Please sign in to comment.