Skip to content
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

Revert PR#18 #21

Merged
merged 1 commit into from
Nov 21, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha, or 1.2.0.1 for a patch release of the 1.2.0 proto release
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
required: true

jobs:
Expand All @@ -26,14 +26,14 @@ jobs:
remote-build-cache-proxy-enabled: false
arguments: build --stacktrace
properties: |
release.version.prop=${{ github.event.inputs.version }}
release.version=${{ github.event.inputs.version }}
org.gradle.java.installations.paths=${{ steps.setup-java-17.outputs.path }}
- uses: burrunan/[email protected]
with:
remote-build-cache-proxy-enabled: false
arguments: final closeAndReleaseSonatypeStagingRepository --stacktrace
properties: |
release.version.prop=${{ github.event.inputs.version }}
release.version=${{ github.event.inputs.version }}
org.gradle.java.installations.paths=${{ steps.setup-java-17.outputs.path }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
Expand Down
35 changes: 10 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,7 @@ plugins {
id("otel.publish-conventions")
}

// Resolve protoVersion and releaseVersion
// If user provides property release.version.prop match against releaseVersionRegex. protoVersion is the semconv matching group (i.e. for release.version.prop=1.3.2.1, protoVersion is 1.3.2). releaseVersion is the value of the release.version.prop.
// Else, set protoVersion and releaseVersion to the most recent git tag.
// The releaseVersion is used to set the nebular release plugin release version. Note, the release.version.prop is used because the nebula release plugin verifies release.version matches semconv.
// The protoVersion is used to download sources from opentelemetry-proto..
var protoVersion = "unknown"
var releaseVersion = "unknown"
if (properties.contains("release.version.prop")) {
val releaseVersionProperty = properties.get("release.version.prop") as String
val matchResult = "^(?<protoversion>([0-9]*)\\.([0-9]*)\\.([0-9]*)).*\$".toRegex().matchEntire(releaseVersionProperty)
if (matchResult == null) {
throw GradleException("Invalid value for release.version.prop")
}
protoVersion = matchResult.groups["protoversion"]?.value as String
releaseVersion = releaseVersionProperty
} else {
protoVersion = NearestVersionLocator(TagStrategy()).locate(release.grgit).any.toString()
releaseVersion = protoVersion
}
logger.lifecycle("proto version: " + protoVersion)
logger.lifecycle("release version: " + releaseVersion)

val protoArchive = file("$buildDir/archives/opentelemetry-proto-$protoVersion.zip")

release {
version = releaseVersion
defaultVersionStrategy = nebula.plugin.release.git.opinion.Strategies.getSNAPSHOT()
}

Expand Down Expand Up @@ -90,6 +65,16 @@ protobuf {
}
}

// Proto version is set from -Prelease.version or inferred from the latest tag
var protoVersion = if (properties.contains(
"release.version"
)) {
properties.get("release.version") as String
} else {
NearestVersionLocator(TagStrategy()).locate(release.grgit).any.toString()
}
val protoArchive = file("$buildDir/archives/opentelemetry-proto-$protoVersion.zip")

tasks {
val downloadProtoArchive by registering(Download::class) {
onlyIf { !protoArchive.exists() }
Expand Down
Loading