Skip to content

Release use versions from git tags instead of static value #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ on:
jobs:
release:
runs-on: ubuntu-latest
container:
image: adoptopenjdk/openjdk11:jdk-11.0.10_9
steps:
- name: Check out code
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Install necessary tooling
env:
APACHE_THRIFT_VERSION: 0.9.3
run: |
apt-get update &&apt-get install -y wget gcc make build-essential git
apt-get update && apt-get install -y wget gcc make build-essential git

wget https://archive.apache.org/dist/thrift/${APACHE_THRIFT_VERSION}/thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
tar -xvf thrift-${APACHE_THRIFT_VERSION}.tar.gz && \
Expand All @@ -40,9 +43,7 @@ jobs:
- name: Determine release version
id: vars
run: |
# Read version from build.gradle
RELEASE_VERSION=$(grep -E 'version\s*=' build.gradle | sed "s/[[:space:]]*version[[:space:]]*=[[:space:]]*'\(.*\)'/\1/")
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
./gradlew -q printVersion

- name: Publish to Sonatype OSSRH (Maven Central)
env:
Expand Down
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
- Fixed NullPointerException in ContextPropagation when Header is present but fields is null

## 3.11.0
- Added opentracing support in workflow lifecycles #876
- Added opentracing support in workflow lifecycles #876

## 3.10.1
- Fixed the bug: workflow already started for migration
Expand Down Expand Up @@ -121,12 +121,12 @@
- Add CadenceChangeVersion support.
- Allow using other tags in metric reporter.
- Add metric tag to differentiate long-poll and normal request.
### Changed
### Changed
- Fix identity for sticky worker.
- Improve contributing guide.

## 3.5.0
### Changed
### Changed
- Fix consistent query interface which caused overloading ambiguity with variable argument

## 3.4.0
Expand Down Expand Up @@ -318,5 +318,3 @@ to disable use FactoryOptions.disableStickyExecution property.
- Side effects, mutable side effects, random uuid and workflow getVersion support.
- Activity heartbeat throttling.
- Deterministic retry of failed operation.


21 changes: 20 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,22 @@ googleJavaFormat {
tasks.googleJavaFormat.dependsOn 'license'

group = 'com.uber.cadence'
version = '3.12.7-SNAPSHOT'

version = getVersion()

def getVersion() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
def gitTag = stdout.toString().trim().replaceFirst("^v", "")
return gitTag
} catch (Exception e) {
return "0.0.0-LOCAL"
}
}

description = '''Uber Cadence Java Client'''

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

task printVersion {
println "current version: $version"
}

task initDlsSubmodule(type: Exec) {
description = 'Initializes src/main/idls submodule'
commandLine 'git', 'submodule', 'init'
Expand Down