-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spark-lineage): simplified jars, config, auto publish to maven (#…
- Loading branch information
1 parent
4aa1421
commit d23a5bb
Showing
30 changed files
with
643 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Publish Datahub Client | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["build & test"] | ||
types: | ||
- completed | ||
|
||
release: | ||
types: [published, edited] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
check-secret: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
outputs: | ||
publish-enabled: ${{ steps.publish-enabled.outputs.defined }} | ||
steps: | ||
- id: publish-enabled | ||
if: "${{ env.SIGNING_KEY != '' }}" | ||
run: echo "::set-output name=defined::true" | ||
env: | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [check-secret] | ||
if: needs.check-secret.outputs.publish-enabled == 'true' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.6" | ||
- name: checkout upstream repo | ||
run: | | ||
git remote add upstream https://github.com/linkedin/datahub.git | ||
git fetch upstream --tags | ||
- name: publish datahub-client jar | ||
env: | ||
RELEASE_USERNAME: ${{ secrets.RELEASE_USERNAME }} | ||
RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
run: | | ||
echo signingKey=$SIGNING_KEY >> gradle.properties | ||
./gradlew :metadata-integration:java:datahub-client:printVersion | ||
./gradlew :metadata-integration:java:datahub-client:publishToMavenLocal | ||
#./gradlew :metadata-integration:java:datahub-client:closeAndReleaseRepository --info | ||
- name: publish datahub-spark jar | ||
env: | ||
RELEASE_USERNAME: ${{ secrets.RELEASE_USERNAME }} | ||
RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
run: | | ||
echo signingKey=$SIGNING_KEY >> gradle.properties | ||
./gradlew :metadata-integration:java:spark-lineage:printVersion | ||
./gradlew :metadata-integration:java:spark-lineage:publishToMavenLocal | ||
#./gradlew :metadata-integration:java:datahub-client:closeAndReleaseRepository --info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
apply plugin: 'jacoco' | ||
apply plugin: 'signing' | ||
apply plugin: 'io.codearte.nexus-staging' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.palantir.git-version' | ||
import org.apache.tools.ant.filters.ReplaceTokens | ||
|
||
jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation | ||
|
||
|
@@ -21,6 +26,19 @@ jacocoTestReport { | |
dependsOn test // tests are required to run before generating the report | ||
} | ||
|
||
|
||
def details = versionDetails() | ||
version = details.lastTag | ||
version = version.startsWith("v")? version.substring(1): version | ||
// trim version if it is of size 4 to size 3 | ||
def versionParts = version.tokenize(".") | ||
def lastPart = details.isCleanTag? versionParts[2]: (versionParts[2].toInteger()+1).toString() + "-SNAPSHOT" | ||
version = versionParts[0] + "." + versionParts[1] + "." + lastPart | ||
|
||
processResources { | ||
filter(ReplaceTokens, tokens:[fullVersion: gitVersion()]) | ||
} | ||
|
||
test { | ||
useJUnit() | ||
finalizedBy jacocoTestReport | ||
|
@@ -64,3 +82,79 @@ checkShadowJar { | |
assemble { | ||
dependsOn shadowJar | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
archiveClassifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
archiveClassifier = 'javadoc' | ||
from javadoc | ||
} | ||
|
||
|
||
publishing { | ||
publications { | ||
shadow(MavenPublication) { | ||
publication -> project.shadow.component(publication) | ||
pom { | ||
name = 'Datahub Client' | ||
group = 'io.acryl' | ||
artifactId = 'datahub-client' | ||
description = 'DataHub Java client for metadata integration' | ||
url = 'https://datahubproject.io' | ||
artifacts = [ shadowJar, javadocJar, sourcesJar ] | ||
|
||
scm { | ||
connection = 'scm:git:git://github.com/linkedin/datahub.git' | ||
developerConnection = 'scm:git:ssh://github.com:linkedin/datahub.git' | ||
url = 'https://github.com/linkedin/datahub.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'datahub' | ||
name = 'Datahub' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
def ossrhUsername = System.getenv('RELEASE_USERNAME') | ||
def ossrhPassword = System.getenv('RELEASE_PASSWORD') | ||
credentials { | ||
username ossrhUsername | ||
password ossrhPassword | ||
} | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
} | ||
} | ||
} | ||
|
||
|
||
signing { | ||
def signingKey = findProperty("signingKey") | ||
def signingPassword = System.getenv("SIGNING_PASSWORD") | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications.shadow | ||
} | ||
|
||
nexusStaging { | ||
serverUrl = "https://s01.oss.sonatype.org/service/local/" //required only for projects registered in Sonatype after 2021-02-24 | ||
username = System.getenv("NEXUS_USERNAME") | ||
password = System.getenv("NEXUS_PASSWORD") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
metadata-integration/java/datahub-client/src/main/resources/client.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
clientVersion=@fullVersion@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.