-
Notifications
You must be signed in to change notification settings - Fork 2
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
Release publishing #7
Conversation
266070c
to
42ccff8
Compare
42ccff8
to
2908c14
Compare
@@ -30,3 +31,62 @@ spotless { | |||
} | |||
|
|||
classes.dependsOn 'spotlessApply' | |||
|
|||
ext.getVersionName = { -> | |||
def version = System.getenv('NEXUS_SDK_TAG') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not really yet any value to the more advanced Temporal Java SDK approach of temporarily tagging and then git describe --tags
to pull it right out. So our publishing step requires this env var instead.
@@ -2,6 +2,7 @@ | |||
plugins { | |||
id 'java-library' | |||
id 'com.diffplug.spotless' | |||
id 'com.vanniktech.maven.publish' version '0.29.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not good Gradle support for publishing on Central yet: https://central.sonatype.org/publish/publish-portal-gradle/. So https://github.com/vanniktech/gradle-maven-publish-plugin/ is the best of the available options based on trying multiple out.
|
||
import com.vanniktech.maven.publish.SonatypeHost | ||
|
||
mavenPublishing { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While technically some of this could be in the root project, the plugin didn't like that as much and this is the only project being published at this time. If/when we do add more JARs to this project, we can make some of this logic reusable.
&& echo "::set-output name=already_exists::true" \ | ||
|| echo "::set-output name=already_exists::false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new way to setting step output.
&& echo "::set-output name=already_exists::true" \ | |
|| echo "::set-output name=already_exists::false" | |
&& echo "already_exists=true" >> $GITHUB_OUTPUT \ | |
|| echo "already_exists=false" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is taken from Java SDK repo, didn't want to deviate if I didn't have to
gh release create | ||
"$NEXUS_SDK_TAG" | ||
--draft | ||
--repo "$GITHUB_REPOSITORY" | ||
--title "$NEXUS_SDK_TAG" | ||
--target "$NEXUS_SDK_REF" | ||
--generate-notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing \
for the command line break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed when using the >
yaml multiline approach. This is taken from Java SDK repo, didn't want to deviate if I didn't have to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I see. I like to keep things consistent, so I'd suggest changing the >
to |
as in other steps above, but a big deal either way.
--target "$NEXUS_SDK_REF" | ||
--generate-notes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to set the permissions for the token to be able to create a release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow has been tested as successful both here and at the Java SDK repo where much of this was taken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. This means the repo is set to give write permissions by default to the token.
gh release create | ||
"$NEXUS_SDK_TAG" | ||
--draft | ||
--repo "$GITHUB_REPOSITORY" | ||
--title "$NEXUS_SDK_TAG" | ||
--target "$NEXUS_SDK_REF" | ||
--generate-notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I see. I like to keep things consistent, so I'd suggest changing the >
to |
as in other steps above, but a big deal either way.
--target "$NEXUS_SDK_REF" | ||
--generate-notes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. This means the repo is set to give write permissions by default to the token.
This workflow was confirmed to work through trial and error