Skip to content

Commit

Permalink
Updating the netflixoss project plugin (#276)
Browse files Browse the repository at this point in the history
Upgrading gradle

Printing version

Printing version

Trying something

trying something else

trying something else

Printing all released artifacts

Cleaning up

trying something else

Add PR comment

Co-authored-by: Sundaram Ananthanarayanan <[email protected]>
  • Loading branch information
sundargates and sundargates authored Oct 28, 2022
1 parent 1d31a21 commit ac60852
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 178 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/nebula-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: "Publish snapshot to NetflixOSS and Maven Central"

on:
push:
branches:
- '**'
pull_request_target:

jobs:
build:
Expand All @@ -25,4 +23,17 @@ jobs:
NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }}
NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }}
with:
arguments: build snapshot
arguments: --info --stacktrace build -x test snapshot
- name: Create PR Comment String
run: |
MY_STRING=$(cat ${GITHUB_WORKSPACE}/build/versions.txt)
echo "::set-output name=content::$MY_STRING"
id: my_string
- name: Upload
uses: mshick/add-pr-comment@v1
with:
message: |
**Uploaded Artifacts**
"${{ steps.my_string.outputs.content }}"
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false # This is the default
20 changes: 19 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
}
}
dependencies {
classpath 'com.netflix.nebula:gradle-netflixoss-project-plugin:9.4.2'
classpath 'com.netflix.nebula:gradle-netflixoss-project-plugin:10.6.0'
classpath 'com.netflix.nebula:nebula-dependency-recommender:11.+'
classpath 'io.mantisrx:mantis-gradle-plugin:1.2.+'
classpath "io.freefair.gradle:lombok-plugin:5.3.3.3"
Expand Down Expand Up @@ -90,6 +90,8 @@ allprojects {
apply plugin: 'nebula.netflixoss'
}

def printAllReleasedArtifacts = project.tasks.create('printAllReleasedArtifacts')
project.snapshot.configure { finalizedBy printAllReleasedArtifacts }
subprojects {
apply plugin: 'java-library'

Expand Down Expand Up @@ -142,6 +144,22 @@ subprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}

project.plugins.withType(MavenPublishPlugin) {
def printReleasedArtifact = project.tasks.create('printReleasedArtifact')
printReleasedArtifact.doLast {
def file1 = file("${buildDir}/tmp/publishNebulaPublicationToNetflixOSSRepository/maven-metadata.xml")
def file2 = file("${buildDir}/tmp/publishNebulaPublicationToNetflixOSSRepository/snapshot-maven-metadata.xml")
def xmlText = file1.exists() ? file1.text : (file2.exists() ? file2.text : "file not found")
def xml = new XmlParser(false, false).parseText(xmlText)
def snapshotVersion = xml.versioning.snapshotVersions.snapshotVersion[0].'value'.text()
logger.lifecycle("${project.group}:${project.name}:${snapshotVersion}")
file("${project.rootProject.buildDir}/versions.txt").append("${project.group}:${project.name}:${snapshotVersion}\n")
}

printReleasedArtifact.dependsOn(project.rootProject.snapshot)
printAllReleasedArtifacts.dependsOn("${project.path}:printReleasedArtifact")
}
}

apply from: file('baseline.gradle')
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Mar 26 09:45:11 PDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ac60852

Please sign in to comment.