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
63 changes: 15 additions & 48 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,35 @@
name: Java CI

on:
push:
branches:
- master
pull_request:
branches:
- master
on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Fetch Tags
if: ${{ !startsWith(github.ref, 'refs/tags') }}
run: git fetch --tags --force

run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
if: "!contains(github.ref, 'refs/tags')"
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Cache Gradle and Assets
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle
build/assets
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '.gradle/dependency-locks/*') }}
restore-keys: |
${{ runner.os }}-gradle-

distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Plugin
run: |
./gradlew clean build --info
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"

- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: |
VERSION=$(./gradlew currentVersion -q -Prelease.quiet | tail -n 1)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Detected version: ${VERSION}"

- name: Show build contents
run: |
echo "Build directory contents:"
find build/ -ls

- name: Upload Plugin Artifact
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Upload git-plugin jar
uses: actions/upload-artifact@v4
with:
name: git-plugin-${{ steps.get_version.outputs.VERSION }}
path: |
build/libs/git-plugin-${{ steps.get_version.outputs.VERSION }}.jar
if-no-files-found: error
# Artifact name
name: Grails-Plugin-${{ steps.get_version.outputs.VERSION }}
# Directory containing files to upload
path: build/libs/git-plugin-${{ steps.get_version.outputs.VERSION }}.jar
65 changes: 25 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,45 @@
name: Create Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*'
- '[0-9]+.[0-9]+.[0-9]+' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
release:
name: Create Release
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Cache Gradle and Assets
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle
build/assets
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '.gradle/dependency-locks/*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Release
run: ./gradlew clean build --info

distribution: 'zulu'
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: |
VERSION=$(./gradlew currentVersion -q -Prelease.quiet | tail -n 1)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Detected version: ${VERSION}"

run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
files: |
run: |
gh release create \
--generate-notes \
--title 'Release ${{ steps.get_version.outputs.VERSION }}' \
${{ github.ref_name }} \
build/libs/git-plugin-${{ steps.get_version.outputs.VERSION }}.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 }}
36 changes: 36 additions & 0 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
push:
branches:
- master # Trigger on commits to the master branch
tags-ignore:
- '*' # Exclude all pushes that are tags

name: Snapshot Release

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
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: 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 }}
49 changes: 37 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.16.1'
alias(libs.plugins.axionRelease)
alias(libs.plugins.nexusPublish)
id 'java'
}

group 'com.rundeck'

ext.rundeckPluginVersion = '1.2'
ext.publishName = "Git Plugin ${project.version}"
ext.githubSlug = 'rundeck-plugins/git-plugin'
ext.pluginClassNames='com.rundeck.plugin.GitResourceModelFactory,com.rundeck.plugin.GitCloneWorkflowStep,com.rundeck.plugin.GitPushWorkflowStep,com.rundeck.plugin.GitCommitWorkflowStep,com.rundeck.plugin.GitAddWorkflowStep'
ext.pluginName = 'Git Plugin'
ext.pluginDescription = 'This is a git plugin (based on Jgit) which contain a Resource model and worflow steps'
ext.developers = [
[id: 'ltamaster', name: 'Luis Toledo', email: 'luis@variacode.com']
]


java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}

scmVersion {
ignoreUncommittedChanges = true
tag {
prefix = ''
versionSeparator = ''
}
versionCreator("simple")
}
project.version = scmVersion.version

Expand All @@ -35,27 +51,23 @@ configurations {


dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
// Use catalog aliases for dependencies
implementation(libs.groovyAll)
implementation(libs.rundeckCore)
implementation(libs.slf4jApi)

implementation group: 'org.rundeck', name: 'rundeck-core', version: '5.1.0-rc2-20240124'
implementation 'org.slf4j:slf4j-api:1.7.30'

pluginLibs('org.eclipse.jgit:org.eclipse.jgit:6.6.1.202309021850-r') {
pluginLibs(libs.jgit) {
exclude module: 'slf4j-api'
exclude module: 'jsch'
exclude module: 'commons-logging'
}

pluginLibs ("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:5.13.2.202306221912-r"){
pluginLibs(libs.jgitSsh) {
exclude module: 'slf4j-api'
exclude group: 'org.bouncycastle'
}

testImplementation "org.codehaus.groovy:groovy-all:3.0.9"
testImplementation "org.spockframework:spock-core:2.0-groovy-3.0"
testImplementation "cglib:cglib-nodep:2.2.2"
testImplementation 'org.objenesis:objenesis:1.4'
testImplementation libs.bundles.testLibs
}


Expand Down Expand Up @@ -84,3 +96,16 @@ jar {
}
dependsOn(copyToLib)
}

nexusPublishing {
packageGroup = 'org.rundeck.plugins'
repositories {
sonatype()
}
}

test {
useJUnitPlatform()
}

apply from: "${rootDir}/gradle/publishing.gradle"
32 changes: 32 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[versions]
# Plugins
axionRelease = "1.18.18"
# Libraries
groovy = "3.0.22"
junit = "4.13.2"
rundeckCore = "5.10.0-20250312"
slf4j = "1.7.36"
jgit = "6.6.1.202309021850-r"
jgitSsh = "5.13.3.202401111512-r"
spock = "2.0-groovy-3.0"
cglib = "3.3.0"
objenesis = "1.4"
nexusPublish = "1.3.0"

[libraries]
groovyAll = { group = "org.codehaus.groovy", name = "groovy-all", version.ref = "groovy" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
rundeckCore = { group = "org.rundeck", name = "rundeck-core", version.ref = "rundeckCore" }
slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
jgit = { group = "org.eclipse.jgit", name = "org.eclipse.jgit", version.ref = "jgit" }
jgitSsh = { group = "org.eclipse.jgit", name = "org.eclipse.jgit.ssh.jsch", version.ref = "jgitSsh" }
spockCore = { group = "org.spockframework", name = "spock-core", version.ref = "spock" }
cglibNodep = { group = "cglib", name = "cglib-nodep", version.ref = "cglib" }
objenesis = { group = "org.objenesis", name = "objenesis", version.ref = "objenesis" }

[bundles]
testLibs = ["junit", "groovyAll", "spockCore", "cglibNodep", "objenesis"]

[plugins]
axionRelease = { id = "pl.allegro.tech.build.axion-release", version.ref = "axionRelease" }
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublish" }
Loading