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
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Fetch Tags
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
- name: Set up JDK 1.11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: '17'
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Upload docker zip
uses: actions/upload-artifact@v4
with:
Expand Down
48 changes: 21 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,42 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
- '*.*.*'

name: Create Release
name: Publish Release

jobs:
build:
name: Upload Release Asset
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 1.11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
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 ::set-output name=VERSION::$VERSION
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
run: |
gh release create \
--generate-notes \
--title 'Release ${{ steps.get_version.outputs.VERSION }}' \
${{ github.ref_name }} \
build/libs/docker-${{ steps.get_version.outputs.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false

- name: Upload Plugin (zip)
id: upload-release-asset
uses: actions/upload-release-asset@v1
- name: Publish to Maven Central
run: ./gradlew -PsigningKey=${SIGNING_KEY_B64} -PsigningPassword=${SIGNING_PASSWORD} -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./build/libs/docker-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: docker-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip

SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_B64: ${{ secrets.SIGNING_KEY_B64 }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
121 changes: 103 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,116 @@
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.17.2'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

ext.pluginName = 'Docker Plugin'
ext.pluginDescription = "Docker manager plugin"
ext.sopsCopyright = "© 2022, Rundeck, Inc."
ext.sopsUrl = "http://rundeck.com"
ext.buildDateString=new Date().format("yyyy-MM-dd'T'HH:mm:ssX")
ext.archivesBaseName = "docker"
ext.pluginBaseFolder = "."
group = 'org.rundeck.plugins'

scmVersion {
ignoreUncommittedChanges = true
ignoreUncommittedChanges = false
tag {
prefix = ''
prefix = '' // NO "v" prefix - see PLUGIN_TAGGING_ARCHITECTURE.md
versionSeparator = ''
def origDeserialize=deserialize
}
}

version = scmVersion.version // Dynamic version from git tag

// Plugin metadata
ext {
pluginName = 'Docker Plugin'
pluginDescription = "Docker manager plugin"
sopsCopyright = "© 2022, Rundeck, Inc."
sopsUrl = "http://rundeck.com"
buildDateString = new Date().format("yyyy-MM-dd'T'HH:mm:ssX")
archivesBaseName = "docker"
pluginBaseFolder = "."
}

ext.archiveFilename = "${archivesBaseName}-${version}"
ext.publishName = "Docker Plugin ${project.version}"
ext.githubSlug = 'rundeck-plugins/docker'
ext.developers = [
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com']
]

import org.apache.tools.ant.filters.ReplaceTokens

// Set default tasks
defaultTasks('clean', 'build', 'pluginZip')

task pluginZip(type: Jar) {
archiveBaseName = archivesBaseName
archiveVersion = version
archiveClassifier = ''
archiveExtension = 'zip'
destinationDirectory = layout.buildDirectory.dir('libs')

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

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

project.version = scmVersion.version
ext.archiveFilename = ext.archivesBaseName + '-' + version
pluginZip.doFirst {
def assetsMap = new Properties()
def tokens = assetsMap + [
version : project.version.toString(),
date : new Date().format("yyyy-MM-dd'T'HH:mm:ssX"),
author : sopsCopyright,
url : sopsUrl,
title : pluginName,
description: pluginDescription,
name : archivesBaseName,
]

copy {
from(file('resources')) {
include('**/*')
into('resources')
}

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

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

into(layout.buildDirectory.dir('zip-contents'))
}
}

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"

tasks.named('build').configure { dependsOn(pluginZip) }

task install(dependsOn: ['build', 'publishToMavenLocal']) {
}

apply from: 'https://raw.githubusercontent.com/rundeck-plugins/build-zip/gradle-5.6/build.gradle'
tasks.named('clean').configure { delete('build') }
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 = 'docker'
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.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
Comment thread
fdevans marked this conversation as resolved.
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading