Skip to content
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
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
tags:
- '*.*.*'

name: Publish Release

jobs:
build:
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
run: |
gh release create \
--generate-notes \
--title 'Release ${{ steps.get_version.outputs.VERSION }}' \
${{ github.ref_name }} \
build/libs/puppet-apply-step-${{ steps.get_version.outputs.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Maven Central
run: ./gradlew -PsigningKey=${SIGNING_KEY_B64} -PsigningPassword=${SIGNING_PASSWORD} -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_B64: ${{ secrets.SIGNING_KEY_B64 }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
138 changes: 65 additions & 73 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,114 +1,106 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.18.6'
id 'maven-publish'
id 'base'
id 'pl.allegro.tech.build.axion-release' version '1.17.2'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

repositories {
mavenCentral()
}
group = 'org.rundeck.plugins'

// Set extension properties
ext.pluginName = 'puppet-apply-step'
ext.pluginDescription = "executes the puppet apply command on each node matching the Job node filter"
ext.sopsCopyright = "© 2025, Rundeck, Inc."
ext.sopsUrl = "https://rundeck.com"
ext.buildDateString = new Date().format("yyyy-MM-dd'T'HH:mm:ssX")
ext.sopsCopyright = "© 2017, Rundeck, Inc."
ext.sopsUrl = "http://rundeck.com"
ext.buildDateString=new Date().format("yyyy-MM-dd'T'HH:mm:ssX")
ext.archivesBaseName = "puppet-apply-step"
ext.pluginBaseFolder = "puppet-apply-step"
ext.pluginBaseFolder = "."

scmVersion {
ignoreUncommittedChanges = true
ignoreUncommittedChanges = false
tag {
prefix = 'v'
prefix = '' // NO "v" prefix - see PLUGIN_TAGGING_ARCHITECTURE.md
versionSeparator = ''
}
versionCreator 'simple' // Use simple version creator (just tag name)
}

project.version = scmVersion.version

task prepareZipContents {
doLast {
def assetsMap = new Properties()
def tokens = assetsMap + [
version : version,
date : new Date().toString(),
author : sopsCopyright,
url : sopsUrl,
title : pluginName,
description: pluginDescription,
name : archivesBaseName.toString(),
]

copy {
from("${project.projectDir}/puppet-apply-step/resources") {
include '**/*.png'
into "resources"
}

from("${project.projectDir}/puppet-apply-step/contents") {
into "contents"
}

from("${project.projectDir}/puppet-apply-step/plugin.yaml") {
filter(ReplaceTokens, tokens: tokens)
exclude '**/*.png'
}
version = scmVersion.version // Dynamic version from git tag
ext.publishName = "Puppet Apply Step ${project.version}"
ext.githubSlug = 'rundeck-plugins/puppet-apply-step'
ext.developers = [
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com']
]

into "${project.buildDir}/zip-contents"
}
}
}

// Create the plugin zip task using modern Gradle syntax
// ZIP plugin task - must use Jar type for proper manifest handling
task pluginZip(type: Jar) {
dependsOn 'prepareZipContents'
archiveBaseName = project.ext.archivesBaseName
archiveVersion = project.version
archiveBaseName = archivesBaseName
archiveVersion = version
archiveClassifier = ''
archiveExtension = 'zip'
destinationDirectory = file("${buildDir}/libs")
destinationDirectory = layout.buildDirectory.dir('libs')

from("${project.buildDir}/zip-contents") {
include("*.yaml")
include("resources/*")
include("contents/*")
into("${project.ext.archivesBaseName}-v${version}")
from(layout.buildDirectory.dir('zip-contents')) {
include('*.yaml')
include('contents/*')
into("${archivesBaseName}-" + project.version.toString())
}

manifest {
attributes(
'Rundeck-Plugin-Name': pluginName.toString(),
'Rundeck-Plugin-Description': pluginDescription.toString(),
'Rundeck-Plugin-Name': pluginName,
'Rundeck-Plugin-Description': pluginDescription,
'Rundeck-Plugin-Archive': 'true',
'Rundeck-Plugin-File-Version': version,
'Rundeck-Plugin-File-Version': project.version.toString(),
'Rundeck-Plugin-Author': sopsCopyright,
'Rundeck-Plugin-URL': sopsUrl,
'Rundeck-Plugin-Date': buildDateString
)
}
}

publishing {
publications {
mavenZip(MavenPublication) {
artifact pluginZip
pluginZip.doFirst {
def assetsMap = new Properties()
def tokens = assetsMap + [
version : project.version.toString(),
date : buildDateString,
author : sopsCopyright,
url : sopsUrl,
title : pluginName,
description: pluginDescription,
name : archivesBaseName,
]

copy {
from(file('contents')) {
into('contents')
}
}
}

defaultTasks 'clean', 'build', 'pluginZip'
from('plugin.yaml') {
filter(ReplaceTokens, tokens: tokens)
exclude('**/*.png')
}

task build {
dependsOn 'pluginZip'
into(layout.buildDirectory.dir('zip-contents'))
}
}

task install {
dependsOn 'build', 'publishToMavenLocal'
}
// Wire into build lifecycle
assemble.dependsOn pluginZip

task clean(type: Delete) {
delete 'build'
nexusPublishing {
packageGroup = 'org.rundeck.plugins'
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}

apply from: "${rootDir}/gradle/publishing.gradle"
File renamed without changes.
80 changes: 80 additions & 0 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* Zip-based Rundeck plugin publication for Maven Central (artifact uploaded as type jar).
* Requires: ext.publishName, ext.githubSlug, ext.developers; task pluginZip
*/
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {
mavenZip(MavenPublication) {
groupId = project.group.toString()
artifactId = 'puppet-apply-step'
version = project.version.toString()

artifact(tasks.named('pluginZip')) {
extension = 'jar'
}

pom {
packaging = 'jar'
name = publishName
description = project.ext.hasProperty('publishDescription') ? project.ext.publishDescription :
project.description ?: publishName
url = "https://github.com/${githubSlug}"
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = "https://github.com/${githubSlug}"
connection = "scm:git:git@github.com/${githubSlug}.git"
developerConnection = "scm:git:git@github.com:${githubSlug}.git"
}
if (project.ext.developers) {
developers {
project.ext.developers.each { dev ->
developer {
id = dev.id
name = dev.name
email = dev.email
}
}
}
}
}
}
}
repositories {
def pkgcldWriteToken = System.getenv("PKGCLD_WRITE_TOKEN") ?: project.findProperty("pkgcldWriteToken")
if (pkgcldWriteToken) {
maven {
name = "PackageCloudTest"
url = uri("https://packagecloud.io/pagerduty/rundeckpro-test/maven2")
authentication {
header(HttpHeaderAuthentication)
}
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "Bearer " + pkgcldWriteToken
}
}
}
}
}

def base64Decode = { String prop ->
project.findProperty(prop) ?
new String(Base64.getDecoder().decode(project.findProperty(prop).toString())).trim() :
null
}

if (project.hasProperty('signingKey') && project.hasProperty('signingPassword')) {
signing {
useInMemoryPgpKeys(base64Decode("signingKey"), project.signingPassword)
sign(publishing.publications)
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
File renamed without changes.
Loading