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

Update cicd #80

Merged
merged 4 commits into from
Sep 18, 2023
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
3 changes: 1 addition & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
- name: run gradle check
run: ./gradlew check
- name: publish snapshot
# final=false here means SNAPSHOT
run: ./gradlew publishMavenPublicationToSonatypeRepository -Prelease=true -Pfinal=false
run: ./gradlew publishToSonatype
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask Regarding the differences between publishMavenPublicationToSonatypeRepository and publishToSonatype - The former is more specific, if you have different publications configured and you don't want to publish them all at once (which is the case in the Elastic repo) then you can be more specific and set the name of the publication (in this case maven) to publish, but if you are fine with publishing all the configured publications then you can just run publishToSonatype which ends up running all the specific-publication tasks.

It was set to the specific task name mostly due to a copy/paste from what we do at Elastic, however, since there's only one publication configured in this project, then there's no need to be specific, so I've just made the changes 👍

env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
distribution: temurin
java-version: 17.0.6
- name: Build and publish artifacts
run: ./gradlew publishMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository -Prelease=true -Pfinal=${{ inputs.release_type == 'final' && 'true' || 'false' }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Pfinal=${{ inputs.release_type == 'final' && 'true' || 'false' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's just one flag (the final one) that I couldn't find a replacement for in the other repos. It essentially tells whether a release version is snapshot or not. When this flag is false or not provided, the version gets -SNAPSHOT appended before publishing the artifacts, otherwise the version remains untouched as defined in the gradle.properties file.

Having this flag is handy for controlling what type of release we want to publish from within the Gradle script, I couldn't find where in the other repos is the logic that appends (or removes) "-SNAPSHOT" from the version, I'm guessing it might be done in a bash script? @trask @breedx-splk

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check out https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/version.gradle.kts

this involves setting up the whole branching release workflow that the other repos use

I think it's fine to stay with what you have here for now, and we can discuss sync'ing release workflows in the future

env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id("signing")
}

val isARelease = project.hasProperty("release") && project.property("release") == "true"
val isARelease = System.getenv("CI") != null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask I noticed that this env var check is what is being used in here to tell when the compilation is running in a GH action vs anywhere else, which is really cool and cleaner than having to pass a flag to the command, so we no longer need the release param 👍


val android = extensions.findByType(LibraryExtension::class.java)

Expand Down