Skip to content

Commit 1ab4241

Browse files
authored
Release use versions from git tags instead of static value (#1002)
What changed? gradle release now uses the version from git describe added a handy task printVersion to get current version for release simplify the git action Why? Release rc versions requires code commits which slows down the release process. Now tagging a value would just release rc version easily Future Plan If everything looks good, we can change the action to closeAndRelease directly. How did you test it? Sample run https://github.com/shijiesheng/cadence-java-client/actions/runs/15219317469/job/42811806456 Repository is correctly closed.
1 parent 5cbf89e commit 1ab4241

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ on:
1515
jobs:
1616
release:
1717
runs-on: ubuntu-latest
18-
container:
19-
image: adoptopenjdk/openjdk11:jdk-11.0.10_9
2018
steps:
2119
- name: Check out code
22-
uses: actions/checkout@v3
23-
20+
uses: actions/checkout@v4
21+
- name: Set up JDK 11
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '11'
25+
distribution: 'temurin'
26+
cache: 'gradle'
2427
- name: Install necessary tooling
2528
env:
2629
APACHE_THRIFT_VERSION: 0.9.3
2730
run: |
28-
apt-get update &&apt-get install -y wget gcc make build-essential git
31+
apt-get update && apt-get install -y wget gcc make build-essential git
2932
3033
wget https://archive.apache.org/dist/thrift/${APACHE_THRIFT_VERSION}/thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
3134
tar -xvf thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
@@ -40,9 +43,7 @@ jobs:
4043
- name: Determine release version
4144
id: vars
4245
run: |
43-
# Read version from build.gradle
44-
RELEASE_VERSION=$(grep -E 'version\s*=' build.gradle | sed "s/[[:space:]]*version[[:space:]]*=[[:space:]]*'\(.*\)'/\1/")
45-
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
46+
./gradlew -q printVersion
4647
4748
- name: Publish to Sonatype OSSRH (Maven Central)
4849
env:

CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
- Fixed NullPointerException in ContextPropagation when Header is present but fields is null
5656

5757
## 3.11.0
58-
- Added opentracing support in workflow lifecycles #876
58+
- Added opentracing support in workflow lifecycles #876
5959

6060
## 3.10.1
6161
- Fixed the bug: workflow already started for migration
@@ -121,12 +121,12 @@
121121
- Add CadenceChangeVersion support.
122122
- Allow using other tags in metric reporter.
123123
- Add metric tag to differentiate long-poll and normal request.
124-
### Changed
124+
### Changed
125125
- Fix identity for sticky worker.
126126
- Improve contributing guide.
127127

128128
## 3.5.0
129-
### Changed
129+
### Changed
130130
- Fix consistent query interface which caused overloading ambiguity with variable argument
131131

132132
## 3.4.0
@@ -318,5 +318,3 @@ to disable use FactoryOptions.disableStickyExecution property.
318318
- Side effects, mutable side effects, random uuid and workflow getVersion support.
319319
- Activity heartbeat throttling.
320320
- Deterministic retry of failed operation.
321-
322-

build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,22 @@ googleJavaFormat {
4747
tasks.googleJavaFormat.dependsOn 'license'
4848

4949
group = 'com.uber.cadence'
50-
version = '3.12.7-SNAPSHOT'
50+
51+
version = getVersion()
52+
53+
def getVersion() {
54+
try {
55+
def stdout = new ByteArrayOutputStream()
56+
exec {
57+
commandLine 'git', 'describe', '--tags'
58+
standardOutput = stdout
59+
}
60+
def gitTag = stdout.toString().trim().replaceFirst("^v", "")
61+
return gitTag
62+
} catch (Exception e) {
63+
return "0.0.0-LOCAL"
64+
}
65+
}
5166

5267
description = '''Uber Cadence Java Client'''
5368

@@ -96,6 +111,10 @@ license {
96111
excludes(["**/*.json", "**/idls","com/uber/cadence/*.java", "com/uber/cadence/shadower/*.java"]) // config files and generated code
97112
}
98113

114+
task printVersion {
115+
println "current version: $version"
116+
}
117+
99118
task initDlsSubmodule(type: Exec) {
100119
description = 'Initializes src/main/idls submodule'
101120
commandLine 'git', 'submodule', 'init'

0 commit comments

Comments
 (0)