-
Notifications
You must be signed in to change notification settings - Fork 148
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
output released version in github actions environement #737
Conversation
7615490
to
e222019
Compare
1c64c9d
to
60e5b03
Compare
|
||
if (isGitHubWorkflowContext()) { | ||
def gitHubOutputFile = new File(System.getenv('GITHUB_OUTPUT')) | ||
"current-version=${outputContent}\n" >> gitHubOutputFile |
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.
If we do it here, it will still require to explicitly run ./gradlew currentVersion
task to produce the step output with current version. I would prefer it to happen during every ./gradlew release
(only we would need to rename the output variable to released-version
).
Alternatively, outputting the current-version
seems like a very general (yet useful) feature that I would like to have on every ./gradlew
execution. I can think of it as a responsibility of the setup-gradle
action, not any plugin (let actions do Github stuff and plugins do Gradle stuff). It could be implemented like this:
// init.gradle.kts
rootProject {
afterEvaluate {
File(System.getenv('GITHUB_OUTPUT')).writeText("current-version=$version)
}
}
This solution also doesn't require bumping axion-release
plugin in every repo, we only need to remove the Read released version
step (and maybe rename the output variable)
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.
We won't need to init.gradle in our case, so I think we should implement this feature here anyway - to be used in the future ;)
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.
Implementing it here will require you to apply axion-release
plugin if you want to use the reusable workflow java-package
. IMO it should be done in our setup-gradle
action so any other plugin for reading version from nearest tag (or even git describe
) can be used- the current-version
output will just always be present in every step executing ./gradlew
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.
yes, but I think this feature can be separated from our usecase
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.
As discussed offline - let's do it as described in my first proposition:
I would prefer it to happen during every ./gradlew release (only we would need to rename the output variable to released-version).
So basically: move it to release
task and rename from current-version
to released-version
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.
@radoslaw-panuszewski code updated!
b3f166c
to
0e4197a
Compare
0e4197a
to
4733f99
Compare
c64ef1f
to
bfe5f24
Compare
5add7c4
to
8ba29a0
Compare
8ba29a0
to
facd9c7
Compare
@@ -34,6 +39,24 @@ class SimpleIntegrationTest extends BaseIntegrationTest { | |||
result.task(":currentVersion").outcome == TaskOutcome.SUCCESS | |||
} | |||
|
|||
def "should define an github output when running release task in github workflow context"() { |
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.
an -> a
I think you should add some info about this feature in docs. I would not expect gradle plugin to mess with github variables under the hood so it may be trickier to analyse what is happening in CI for people who do not know about this change. Good docs would probably help. |
Yes, I'm going to update docs |
No description provided.