Skip to content

Commit

Permalink
add step top fetch latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
malmstein committed Oct 23, 2024
1 parent 380feb8 commit e38c99a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 43 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ jobs:
with:
submodules: recursive

- name: Setup JDK 20
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 20

- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Fetch Latest Git Tag
id: fetch_tag
run: |
git fetch --tags
TAG=$(git describe --tags --abbrev=0)
echo "latest_tag=$TAG" >> $GITHUB_ENV
- name: Show the latest tag
run: |
echo "The latest git tag is: ${{ steps.fetch_tag.outputs.latest_tag }}"
- name: Generate nightly version name
id: generate_version_name
run: |
output=$(./gradlew getBuildVersionName -PversionNameSuffix=-nightly | tail -n 1)
output=$(./gradlew getBuildVersionName -PversionNameSuffix=-nightly -PlatestTag= ${{ steps.fetch_tag.outputs.latest_tag }} -q | tail -n 1)
echo "version=$output" >> $GITHUB_OUTPUT
- name: Use the captured output
Expand Down
4 changes: 1 addition & 3 deletions app/version/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#Wed Oct 23 11:43:47 CEST 2024
NEW_TAG=5.217.0.10-nightly
VERSION=5.217.0
TAG=5.217.0.9-nightly
VERSION=5.217.0
37 changes: 6 additions & 31 deletions versioning.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ ext {
}

getStoredTag = {
def props = new Properties()
file("$rootDir/app/version/version.properties").withInputStream { props.load(it) }
return props.getProperty("TAG")
if(project.hasProperty("latestTag")) {
return project["latestTag"]
} else {
def latestGitTagProvider = providers.of(LatestGitTagValueSource.class) {}
return latestGitTagProvider.get()
}
}

buildNumberCode = {
Expand All @@ -63,34 +66,6 @@ ext {
}
}

tasks.register('incrementTag') {
doLast {
if (project.hasProperty("versionNameSuffix")) {
println("Incrementing tag for Nightly release")
} else {
println("Incrementing tag for Production release")
}

def filePath = "$rootDir/app/version/version.properties"
if(!new File(filePath).exists()) {
return
}

def props = new Properties()
props.load(new FileInputStream(filePath))
String currentTag = props["TAG"]
println("Current tag is $currentTag")

def versionName = buildVersionName()

println("Storing new tag as $versionName")

props["NEW_TAG"] = versionName.toString()
def os = new FileOutputStream(filePath)
props.store(os, null)
}
}

tasks.register("setBuildNumber") {
doLast {
if(!project.hasProperty("number")) {
Expand Down

0 comments on commit e38c99a

Please sign in to comment.