Skip to content

Commit 1e44b9a

Browse files
committed
Update build [claude]
1 parent e0559e4 commit 1e44b9a

File tree

9 files changed

+237
-107
lines changed

9 files changed

+237
-107
lines changed

.github/workflows/gradle.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
name: Java CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
9-
108
steps:
11-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1210
with:
1311
fetch-depth: 0
14-
- name: Get Fetch Tags
15-
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
16-
if: "!contains(github.ref, 'refs/tags')"
17-
- name: Set up JDK 1.11
18-
uses: actions/setup-java@v1
12+
- name: Set up JDK 11
13+
uses: actions/setup-java@v4
1914
with:
20-
java-version: 11
21-
- name: Grant execute permission for gradlew
22-
run: chmod +x gradlew
15+
java-version: '11'
16+
distribution: 'zulu'
2317
- name: Build with Gradle
2418
run: ./gradlew build
2519
- name: Copy Artifact for integration test
@@ -28,11 +22,9 @@ jobs:
2822
run: ./gradlew :functional-test:functionalTest
2923
- name: Get Release Version
3024
id: get_version
31-
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
25+
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
3226
- name: Upload plugin jar
3327
uses: actions/upload-artifact@v4
3428
with:
35-
# Artifact name
36-
name: Grails-Plugin-${{ steps.get_version.outputs.VERSION }}
37-
# Directory containing files to upload
29+
name: ansible-plugin-${{ steps.get_version.outputs.VERSION }}
3830
path: build/libs/ansible-plugin-${{ steps.get_version.outputs.VERSION }}.jar

.github/workflows/release.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,43 @@ on:
22
push:
33
# Sequence of patterns matched against refs/tags
44
tags:
5-
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
5+
- 'v[0-9]+.[0-9]+.[0-9]+' # Push events to matching v*, i.e. v1.0, v20.15.10
66

7-
name: Upload Release Asset
7+
name: Publish Release
88

99
jobs:
1010
build:
11-
name: Upload Release Asset
11+
name: Publish Release
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
- name: set up JDK 1.11
19-
uses: actions/setup-java@v1
18+
- name: Set up JDK 11
19+
uses: actions/setup-java@v4
2020
with:
21-
java-version: 11
21+
java-version: '11'
22+
distribution: 'zulu'
2223
- name: Build with Gradle
2324
run: ./gradlew build
2425
- name: Get Release Version
2526
id: get_version
26-
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
27+
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
2728
- name: Create Release
2829
id: create_release
29-
uses: actions/create-release@v1.0.0
30+
run: |
31+
gh release create \
32+
--generate-notes \
33+
--title 'Release ${{ steps.get_version.outputs.VERSION }}' \
34+
${{ github.ref_name }} \
35+
build/libs/ansible-plugin-${{ steps.get_version.outputs.VERSION }}.jar
3036
env:
3137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
with:
33-
tag_name: ${{ github.ref }}
34-
release_name: Release ${{ steps.get_version.outputs.VERSION }}
35-
draft: false
36-
prerelease: false
37-
- name: Upload Release Asset (jar)
38-
id: upload-release-asset
39-
uses: actions/upload-release-asset@v1
38+
- name: Publish to Maven Central
39+
run: ./gradlew -PsigningKey=${SIGNING_KEY_B64} -PsigningPassword=${SIGNING_PASSWORD} -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} publishToSonatype closeAndReleaseSonatypeStagingRepository
4040
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
with:
43-
upload_url: ${{ steps.create_release.outputs.upload_url }}
44-
asset_path: build/libs/ansible-plugin-${{ steps.get_version.outputs.VERSION }}.jar
45-
asset_name: ansible-plugin-${{ steps.get_version.outputs.VERSION }}.jar
46-
asset_content_type: application/octet-stream
41+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
42+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
43+
SIGNING_KEY_B64: ${{ secrets.SIGNING_KEY_B64 }}
44+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

build.gradle

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,121 @@
11
plugins {
2-
id 'pl.allegro.tech.build.axion-release' version '1.17.2'
3-
id 'maven-publish'
2+
id 'java'
3+
id 'groovy'
4+
id 'idea'
5+
alias(libs.plugins.axionRelease)
6+
alias(libs.plugins.nexusPublish)
47
}
58

6-
group = 'com.github.rundeck-plugins'
9+
group = 'org.rundeck.plugins'
710

11+
ext.pluginName = 'Ansible Integration'
12+
ext.publishDescription = 'This plugin brings basic Ansible support to Rundeck. It imports hosts from Ansible\'s inventory, including a bunch of facts, and can run modules and playbooks. There is also a node executor and file copier for your project.'
13+
ext.publishName = "Ansible Plugin ${project.version}"
14+
ext.githubSlug = 'rundeck-plugins/ansible-plugin'
15+
ext.developers = [
16+
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com'],
17+
[id: 'daisuke-yoshimoto', name: 'Daisuke Yoshimoto', email: 'yoshimoto@gmail.com']
18+
]
819
ext.rundeckPluginVersion = '1.2'
920
ext.pluginClassNames = [
10-
'com.rundeck.plugins.ansible.plugin.AnsibleResourceModelSourceFactory',
11-
'com.rundeck.plugins.ansible.plugin.AnsibleNodeExecutor',
12-
'com.rundeck.plugins.ansible.plugin.AnsibleFileCopier',
13-
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookWorkflowStep',
14-
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookInlineWorkflowStep',
15-
'com.rundeck.plugins.ansible.plugin.AnsibleModuleWorkflowStep',
16-
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookWorflowNodeStep',
17-
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookInlineWorkflowNodeStep',
18-
'com.rundeck.plugins.ansible.logging.AnsibleSetStatsFilterPlugin',
19-
'com.rundeck.plugins.ansible.plugin.AnsiblePluginGroup'
21+
'com.rundeck.plugins.ansible.plugin.AnsibleResourceModelSourceFactory',
22+
'com.rundeck.plugins.ansible.plugin.AnsibleNodeExecutor',
23+
'com.rundeck.plugins.ansible.plugin.AnsibleFileCopier',
24+
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookWorkflowStep',
25+
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookInlineWorkflowStep',
26+
'com.rundeck.plugins.ansible.plugin.AnsibleModuleWorkflowStep',
27+
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookWorflowNodeStep',
28+
'com.rundeck.plugins.ansible.plugin.AnsiblePlaybookInlineWorkflowNodeStep',
29+
'com.rundeck.plugins.ansible.logging.AnsibleSetStatsFilterPlugin',
30+
'com.rundeck.plugins.ansible.plugin.AnsiblePluginGroup'
2031
].join(',')
2132

22-
apply plugin: 'java'
23-
apply plugin: 'groovy'
24-
sourceCompatibility = 1.11
25-
2633
scmVersion {
27-
ignoreUncommittedChanges = false
2834
tag {
2935
prefix = 'v'
3036
versionSeparator = ''
3137
}
38+
ignoreUncommittedChanges = false
3239
}
3340

34-
version = scmVersion.version
41+
allprojects {
42+
project.version = scmVersion.version
43+
apply from: "${rootDir}/gradle/java.gradle"
44+
}
3545

3646
repositories {
37-
mavenCentral()
38-
mavenLocal()
47+
mavenCentral()
3948
}
4049

4150
configurations {
42-
pluginLibs
51+
pluginLibs
4352

44-
implementation {
45-
extendsFrom pluginLibs
46-
}
53+
implementation {
54+
extendsFrom pluginLibs
55+
}
4756
}
4857

4958
dependencies {
50-
pluginLibs 'com.google.code.gson:gson:2.10.1'
51-
implementation('org.rundeck:rundeck-core:5.1.1-20240305')
52-
implementation 'org.codehaus.groovy:groovy-all:3.0.15'
53-
pluginLibs group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.16.1'
54-
pluginLibs group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.1'
55-
implementation "org.yaml:snakeyaml:2.2"
59+
pluginLibs libs.gson
60+
implementation(libs.rundeckCore) {
61+
exclude group: "com.google.guava"
62+
}
63+
implementation libs.groovyAll
64+
pluginLibs libs.jacksonCore
65+
pluginLibs libs.jacksonYaml
66+
implementation libs.snakeyaml
5667

57-
compileOnly 'org.projectlombok:lombok:1.18.30'
58-
annotationProcessor 'org.projectlombok:lombok:1.18.30'
68+
compileOnly libs.lombok
69+
annotationProcessor libs.lombok
5970

60-
testCompileOnly 'org.projectlombok:lombok:1.18.30'
61-
testAnnotationProcessor 'org.projectlombok:lombok:1.18.30'
71+
testCompileOnly libs.lombok
72+
testAnnotationProcessor libs.lombok
6273

63-
testImplementation "org.spockframework:spock-core:2.1-groovy-3.0"
74+
testImplementation libs.bundles.testLibs
75+
}
6476

77+
task copyToLib(type: Copy) {
78+
into "$buildDir/output/lib"
79+
from configurations.pluginLibs
6580
}
6681

67-
tasks.withType(Test).configureEach {
68-
useJUnitPlatform()
82+
jar {
83+
from "$buildDir/output"
84+
manifest {
85+
def libList = configurations.pluginLibs.collect{'lib/' + it.name}.join(' ')
86+
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion,
87+
'Rundeck-Plugin-Archive': 'true',
88+
'Rundeck-Plugin-File-Version': project.version,
89+
'Rundeck-Plugin-Name' : pluginName,
90+
'Rundeck-Plugin-Description' : publishDescription,
91+
'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.0.1+',
92+
'Rundeck-Plugin-Tags': 'java,node executor,resource model,workflow step,ansible',
93+
'Rundeck-Plugin-License': 'MIT',
94+
'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck-plugins/ansible-plugin',
95+
'Rundeck-Plugin-Target-Host-Compatibility': 'all',
96+
'Rundeck-Plugin-Author': 'David Kirstein',
97+
'Rundeck-Plugin-Classnames': pluginClassNames,
98+
'Rundeck-Plugin-URL': 'https://github.com/rundeck-plugins/ansible-plugin',
99+
'Rundeck-Plugin-Libs': "${libList}",
100+
'Rundeck-Plugin-Date': new Date().format("yyyy-MM-dd'T'HH:mm:ssX")
101+
}
102+
dependsOn(copyToLib)
69103
}
70104

71-
task copyToLib(type: Copy) {
72-
into "$buildDir/output/lib"
73-
from configurations.pluginLibs
105+
test {
106+
useJUnitPlatform()
74107
}
75108

76-
jar {
77-
from "$buildDir/output"
78-
manifest {
79-
def libList = configurations.pluginLibs.collect{'lib/' + it.name}.join(' ')
80-
attributes 'Rundeck-Plugin-Name' : 'Ansible Integration'
81-
attributes 'Rundeck-Plugin-Description' : 'This plugin brings basic Ansible support to Rundeck. It imports hosts from Ansible\'s inventory, including a bunch of facts, and can run modules and playbooks. There is also a node executor and file copier for your project.'
82-
attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.0.1+'
83-
attributes 'Rundeck-Plugin-Tags': 'java,node executor,resource model,workflow step,ansible'
84-
attributes 'Rundeck-Plugin-License': 'MIT'
85-
attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck-plugins/ansible-plugin'
86-
attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all'
87-
attributes 'Rundeck-Plugin-Author': 'David Kirstein'
88-
attributes 'Rundeck-Plugin-Classnames': pluginClassNames
89-
attributes 'Rundeck-Plugin-File-Version': version
90-
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion
91-
attributes 'Rundeck-Plugin-Archive': 'true'
92-
attributes 'Rundeck-Plugin-Libs': "${libList}"
93-
attributes 'Rundeck-Plugin-URL': 'https://github.com/rundeck-plugins/ansible-plugin'
94-
}
95-
dependsOn(copyToLib)
109+
javadoc {
110+
options.addStringOption('Xdoclint:none', '-quiet')
111+
failOnError = false
96112
}
97113

98-
publishing {
99-
publications {
100-
maven(MavenPublication) {
101-
artifactId = 'ansible-plugin'
102-
from components.java
114+
nexusPublishing {
115+
packageGroup = 'org.rundeck.plugins'
116+
repositories {
117+
sonatype()
103118
}
104-
}
105119
}
120+
121+
apply from: "${rootDir}/gradle/publishing.gradle"

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
group=org.rundeck.plugins

gradle/java.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
java {
2+
sourceCompatibility = JavaVersion.VERSION_11
3+
withJavadocJar()
4+
withSourcesJar()
5+
}
6+
7+
allprojects {
8+
gradle.projectsEvaluated {
9+
tasks.withType(JavaCompile).configureEach {
10+
options.compilerArgs.add("-Xlint:deprecation")
11+
}
12+
}
13+
}

gradle/libs.versions.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[versions]
2+
axionRelease = "1.18.18"
3+
groovy = "3.0.24"
4+
rundeckCore = "5.10.0-20250312"
5+
nexusPublish = "2.0.0"
6+
spock = "2.3-groovy-3.0"
7+
gson = "2.10.1"
8+
jackson = "2.16.1"
9+
snakeyaml = "2.2"
10+
lombok = "1.18.30"
11+
cglib = "3.3.0"
12+
byteBuddy = "1.14.12"
13+
objenesis = "3.3"
14+
15+
[libraries]
16+
rundeckCore = { group = "org.rundeck", name = "rundeck-core", version.ref = "rundeckCore" }
17+
groovyAll = { group = "org.codehaus.groovy", name = "groovy-all", version.ref = "groovy" }
18+
spockCore = { group = "org.spockframework", name = "spock-core", version.ref = "spock" }
19+
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
20+
jacksonCore = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" }
21+
jacksonYaml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" }
22+
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
23+
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" }
24+
cglib = { group = "cglib", name = "cglib-nodep", version.ref = "cglib" }
25+
byteBuddy = { group = "net.bytebuddy", name = "byte-buddy", version.ref = "byteBuddy" }
26+
objenesis = { group = "org.objenesis", name = "objenesis", version.ref = "objenesis" }
27+
28+
[bundles]
29+
testLibs = ["groovyAll", "spockCore", "cglib", "byteBuddy", "objenesis"]
30+
jacksonLibs = ["jacksonCore", "jacksonYaml"]
31+
32+
[plugins]
33+
axionRelease = { id = "pl.allegro.tech.build.axion-release", version.ref = "axionRelease" }
34+
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublish" }

0 commit comments

Comments
 (0)