Skip to content

Commit

Permalink
Update version name fetching script
Browse files Browse the repository at this point in the history
COAND-977
  • Loading branch information
jreij committed Sep 12, 2024
1 parent 0f109b1 commit 7ecaf79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ jobs:
# Get the version name from a script and save to environment variable.
- name: Set PROJECT_VERSION
run: |
echo "▸ Set run permission."
chmod +x scripts/version_name.sh
echo "▸ Getting version name"
PROJECT_VERSION=$(./scripts/version_name.sh)
PROJECT_VERSION=$(${{github.workspace}}/gradlew -q printVersionName)
echo "▸ Variable PROJECT_VERSION set to: ${PROJECT_VERSION}"
echo "▸ Adding PROJECT_VERSION variable with: $PROJECT_VERSION"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
Expand Down
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
alias libs.plugins.jetbrains.kotlin.android apply false
alias libs.plugins.jetbrains.kotlin.android apply false
alias libs.plugins.ksp apply false
alias libs.plugins.hilt apply false
alias libs.plugins.detekt
Expand Down Expand Up @@ -74,4 +74,14 @@ subprojects {
}
}

tasks.register("printVersionName") {
def version_validation_regex = "^[0-9]{1,2}\\.[0-9]{1,2}\\.[0-9]{1,2}(-(alpha|beta|rc)[0-9]{2}){0,1}\$"
def version_name = libs.versions.version.name.get()
if (version_name ==~ version_validation_regex) {
println version_name
} else {
throw new GradleException("Error: invalid version name [$version_name], please validate that the specified version follows the regex $version_validation_regex")
}
}

apply from: file('config/gradle/dependencyGraph.gradle')
19 changes: 0 additions & 19 deletions scripts/version_name.sh

This file was deleted.

0 comments on commit 7ecaf79

Please sign in to comment.