Skip to content

Instantly share code, notes, and snippets.

@blackpioter
Created November 17, 2016 14:40
Show Gist options
  • Save blackpioter/cffce0726f4510307277b8da2d877bb0 to your computer and use it in GitHub Desktop.
Save blackpioter/cffce0726f4510307277b8da2d877bb0 to your computer and use it in GitHub Desktop.
RPM metadata from git repo
plugins {
id "com.palantir.git-version" version "0.5.2"
id "nebula.rpm" version "4.1.0"
}
jar {
baseName = 'PACKAGE_NAME'
try {
def details = versionDetails()
manifest {
attributes(
'Velocity-Git-Hash': details.gitHash,
'Velocity-Last-Tag': details.lastTag,
'Velocity-Commit-Distance': details.commitDistance,
'Velocity-Created-At': java.time.Instant.now().toEpochMilli()
)
}
} catch (IllegalArgumentException e) {
// Do nothing as there is probably no repo (don't care while migrations are done)
System.println("No repo found, cannot add data to manifest")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment