Skip to content

Commit a8b2ca7

Browse files
devhawkCopilot
andauthored
automatically create a GH release for tagged release branch builds (#274)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent cc4cc7e commit a8b2ca7

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,33 @@ jobs:
3636
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3737
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
3838
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
39+
40+
- name: Get Gradle project version
41+
id: get_version
42+
run: |
43+
VERSION=$(./gradlew properties -q | grep '^version:' | awk '{print $2}')
44+
COMMIT_COUNT=$(./gradlew properties -q | grep '^commitCount:' | awk '{print $2}')
45+
TAGS=$(git tag --points-at HEAD)
46+
47+
echo "Project version: $VERSION, commit Count: $COMMIT_COUNT, tags: $TAGS"
48+
49+
if [ -z "$TAGS" ]; then
50+
echo "is_tagged=false" >> $GITHUB_OUTPUT
51+
else
52+
echo "is_tagged=true" >> $GITHUB_OUTPUT
53+
fi
54+
echo "version=$VERSION" >> $GITHUB_OUTPUT
55+
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
56+
57+
- name: Github Release
58+
if: |
59+
startsWith(github.ref, 'refs/heads/release/v') &&
60+
steps.get_version.outputs.is_tagged == 'true'
61+
uses: softprops/action-gh-release@v2.1.0
62+
with:
63+
name: ${{ steps.get_version.outputs.version }}
64+
prerelease: ${{ steps.get_version.outputs.commit_count != '0' }}
65+
files: |
66+
transact/build/libs/*.jar
67+
transact-cli/build/libs/dbos.jar
68+

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ println("DBOS Transact version: $calculatedVersion")
8181
allprojects {
8282
group = "dev.dbos"
8383
version = calculatedVersion
84+
extra["commitCount"] = "$commitCount"
8485

8586
repositories {
8687
mavenCentral()

0 commit comments

Comments
 (0)