Skip to content
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
2 changes: 1 addition & 1 deletion .agents
2 changes: 1 addition & 1 deletion .github/workflows/agents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
concurrency:
group: agents-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.number }}
queue: max
uses: cinchapi/cinchapi-agent-skills/.github/workflows/router.yml@31f89b30ce3f75f4b381156bf6ee1ce9752de45a
uses: cinchapi/cinchapi-agent-skills/.github/workflows/router.yml@cfd86bdd6113b67c3cd4b281142b29b896a07a0c
permissions:
contents: read
id-token: write
Expand Down
15 changes: 15 additions & 0 deletions .on-version-set.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Sets the version in each build.gradle's pom.version line to $1, the version
# that version.sh is setting, and keeps a -SNAPSHOT suffix where the line has
# one.
set -euo pipefail
new=$1
v='[0-9]+\.[0-9]+\.[0-9]+'
find . -name build.gradle -not -path './.agents/*' -not -path './.git/*' |
while IFS= read -r file; do
sed -i.bak -E \
-e "s/pom\.version = '$v'/pom.version = '$new'/g" \
-e "s/pom\.version = '$v-SNAPSHOT'/pom.version = '$new-SNAPSHOT'/g" \
"$file"
rm "$file.bak"
done
22 changes: 15 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ def getVersion = { ->
return stdout.toString().trim()
}

// The version that a build version publishes as, also from the "version.sh"
// script, which drops only the build number and keeps the branch's name whole.
def getPublishedVersion = { buildVersion ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'bash', 'version.sh', '--published', buildVersion
standardOutput = stdout
}
return stdout.toString().trim()
}

group = 'com.cinchapi'
version = getVersion()
// Drop the build component from version number and use that for
// publishing
ext.mavenVersion = version.split('\\.')
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+-", "-")
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+", "").trim()
ext.mavenVersion = ext.mavenVersion.join(".").replace(".-", "-").replaceAll('\\.$', "")
ext.mavenVersion = getPublishedVersion(version)

task wrapper(type: Wrapper) {
gradleVersion = '3.0'
Expand Down Expand Up @@ -104,7 +110,9 @@ publishing {
name = 'cloudsmith'
def releasesRepoUrl = "https://api-g.cloudsmith.io/maven/cinchapi/open-source/"
def snapshotsRepoUrl = "https://api-g.cloudsmith.io/maven/cinchapi/open-source-snapshots/"
url = mavenVersion.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// Only a master build publishes a plain X.Y.Z, so every other version,
// such as a release candidate or a feature build, is a snapshot.
url = (mavenVersion ==~ /\d+\.\d+\.\d+/) ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv('CLOUDSMITH_API_USER')
password = System.getenv('CLOUDSMITH_API_KEY')
Expand Down
Loading