-
Notifications
You must be signed in to change notification settings - Fork 3
Next Version (2.1.0 | 2.1.0-rc3) #264
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
Changes from all commits
3598384
a5896f5
355b856
9d639bd
8803c60
4afd85e
78b1957
f809820
39518cc
bd8aba4
11fc59c
b594997
5e5a37c
bb170bb
16002a6
a08c314
4e817e9
b855b80
b90d3c8
cc97444
2221627
b36e64b
fe63d12
f2086f3
7d3020c
7257354
e60ae89
db56685
501060d
55648fd
0fba28d
fe179bf
f4046ea
9656ea7
6cbbbc8
77c4279
3b47ecc
c42b185
210d6ac
eb89c94
9cbe059
ec9e9da
7905f12
f2f70ac
57bf583
5f172da
fa6dd22
2507724
88fc710
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||||||||||||||||||||||||
| import java.time.LocalDate | ||||||||||||||||||||||||||||
| import java.time.format.DateTimeFormatter | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * This file defines the updateCff task. | ||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||
| * This task hooks into the workflow of the release task, | ||||||||||||||||||||||||||||
| * which, according to the source code of the release plugin, | ||||||||||||||||||||||||||||
| * seems to be defined like this: | ||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||
| * tasks = [ | ||||||||||||||||||||||||||||
| * "${p}createScmAdapter" as String, | ||||||||||||||||||||||||||||
| * "${p}initScmAdapter" as String, | ||||||||||||||||||||||||||||
| * "${p}checkCommitNeeded" as String, | ||||||||||||||||||||||||||||
| * "${p}checkUpdateNeeded" as String, | ||||||||||||||||||||||||||||
| * "${p}checkoutMergeToReleaseBranch" as String, | ||||||||||||||||||||||||||||
| * "${p}unSnapshotVersion" as String, | ||||||||||||||||||||||||||||
| * "${p}confirmReleaseVersion" as String, | ||||||||||||||||||||||||||||
| * -> we insert our task here <- | ||||||||||||||||||||||||||||
| * "${p}checkSnapshotDependencies" as String, | ||||||||||||||||||||||||||||
| * "${p}runBuildTasks" as String, | ||||||||||||||||||||||||||||
| * "${p}preTagCommit" as String, | ||||||||||||||||||||||||||||
| * "${p}createReleaseTag" as String, | ||||||||||||||||||||||||||||
| * "${p}checkoutMergeFromReleaseBranch" as String, | ||||||||||||||||||||||||||||
| * "${p}updateVersion" as String, | ||||||||||||||||||||||||||||
| * "${p}commitNewVersion" as String | ||||||||||||||||||||||||||||
| * ] | ||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| tasks.register('updateCff') { | ||||||||||||||||||||||||||||
| group = 'release' | ||||||||||||||||||||||||||||
| description = 'Updates the version in CITATION.cff file' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| outputs.file("CITATION.cff") | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+30
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Declare task inputs for up-to-date checks. tasks.register('updateCff') {
group = 'release'
description = 'Updates the version in CITATION.cff file'
- outputs.file("CITATION.cff")
+ inputs.file("CITATION.cff")
+ outputs.file("CITATION.cff")
...
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| doLast { | ||||||||||||||||||||||||||||
| def version = project.version.toString() | ||||||||||||||||||||||||||||
| def today = LocalDate.now().format(DateTimeFormatter.ISO_DATE) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| def cffFile = file('CITATION.cff') | ||||||||||||||||||||||||||||
| def content = cffFile.text | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Update or insert version | ||||||||||||||||||||||||||||
| if (content.contains('version:')) { | ||||||||||||||||||||||||||||
| content = content.replaceAll(/(?m)^version:\s*.+$/, "version: ${version}") | ||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||
| content = content + "\nversion: ${version}" | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Update or insert date-released | ||||||||||||||||||||||||||||
| if (content.contains('date-released:')) { | ||||||||||||||||||||||||||||
| content = content.replaceAll(/(?m)^date-released:\s*.+$/, "date-released: ${today}") | ||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||
| content = content + "\ndate-released: ${today}" | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| cffFile.text = content | ||||||||||||||||||||||||||||
| println "Updated CITATION.cff to version ${version} and date-released ${today}" | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Make sure your custom task runs after a specific task in the release sequence | ||||||||||||||||||||||||||||
| tasks.named('updateCff') { | ||||||||||||||||||||||||||||
| mustRunAfter(tasks.named('confirmReleaseVersion')) | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Ensure subsequent tasks in the release sequence run after your custom task | ||||||||||||||||||||||||||||
| tasks.named('checkSnapshotDependencies') { | ||||||||||||||||||||||||||||
| dependsOn('updateCff') | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.