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/yaml-text-source-${{ 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 }}
30 changes: 21 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
plugins {
id 'java'
id 'pl.allegro.tech.build.axion-release' version '1.18.11'
id 'maven-publish'
id 'pl.allegro.tech.build.axion-release' version '1.18.17'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

group = 'org.rundeck.plugins'

repositories {
mavenCentral()
}
Expand All @@ -20,15 +22,21 @@ ext.pluginBaseFolder = "."
// No Java dependencies needed - this is a script-based plugin

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

project.version = scmVersion.version
version = scmVersion.version // Dynamic version from git tag
ext.archiveFilename = ext.archivesBaseName + '-' + version
ext.publishName = "YAML Test Source ${project.version}"
ext.githubSlug = 'rundeck-plugins/yaml-text-source'
ext.developers = [
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com']
]

// Plugin ZIP task (modernized from the external script)
tasks.register('pluginZip', Jar) {
Expand Down Expand Up @@ -86,14 +94,18 @@ tasks.register('pluginZip', Jar) {
}
}

publishing {
publications {
mavenZip(MavenPublication) {
artifact pluginZip
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"

build {
dependsOn 'pluginZip'
}
Expand Down
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 = 'yaml-text-source'
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)
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
36 changes: 22 additions & 14 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading