Skip to content

Commit

Permalink
Publish jars on release. (#5046)
Browse files Browse the repository at this point in the history
- Modify gradle script to add publishing task to all subprojects that we want to publish.
- Modify release script to publish jars on release.
  • Loading branch information
davinchia authored Jul 28, 2021
1 parent 0414009 commit b6fe893
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 23 deletions.
23 changes: 0 additions & 23 deletions airbyte-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
plugins {
id 'application'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}

shadowJar {
zip64 true
mergeServiceFiles()
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
// Not stubbing this out adds 'all' to the end of the jar's name.
classifier = ''
}

publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
repositories {
mavenLocal()
}
}

dependencies {
Expand Down
46 changes: 46 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,49 @@ tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

// Configure what Subprojects to publish.
String[] toPublish = [
':airbyte-analytics',
':airbyte-api',
':airbyte-commons',
':airbyte-commons-docker',
':airbyte-config:init',
':airbyte-config:models',
':airbyte-config:persistence',
':airbyte-db',
':airbyte-json-validation',
':airbyte-json-notification',
':airbyte-protocol:models',
':airbyte-scheduler:models',
':airbyte-scheduler:client',
':airbyte-scheduler:persistence',
':airbyte-server',
':airbyte-workers'
]
configure(subprojects.findAll { toPublish.contains(it.getPath()) }) {
apply plugin: 'maven-publish'

publishing {
repositories {
publications {
// This block is present so Gradle knows to publish a Maven jar.
maven(MavenPublication) {
// Gradle will by default use the subproject path as the group id and the subproject name as the artifact id.
// e.g. the subproject :airbyte-scheduler:models is imported at io.airbyte.airbyte-config:persistence:<version-number>.
}
}

maven {
credentials {
name 'cloudrepo'
username System.getenv('CLOUDREPO_USER')
password System.getenv('CLOUDREPO_PASSWORD')
}
url 'https://airbyte.mycloudrepo.io/repositories/airbyte-public-jars'
}

mavenLocal()
}
}
}
11 changes: 11 additions & 0 deletions tools/bin/release_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ if [[ "$BRANCH" == "master" ]]; then
exit 1;
fi

if [[ -z "${CLOUDREPO_USER}" ]]; then
echo 'CLOUDREPO_USER env var not set. Please retrieve the user email from the CloudRepo lastpass secret and run export CLOUDREPO_USER=<user_from_secret>.';
exit 1;
fi

if [[ -z "${CLOUDREPO_PASSWORD}" ]]; then
echo 'CLOUDREPO_PASSWORD env var not set. Please retrieve the user email from the CloudRepo lastpass secret and run export CLOUDREPO_PASSWORD=<password_from_secret>.';
exit 1;
fi

PREV_VERSION=$(grep VERSION .env | cut -d"=" -f2)

PART_TO_BUMP=$1
Expand All @@ -30,6 +40,7 @@ echo "Bumped version from ${PREV_VERSION} to ${NEW_VERSION}"
echo "Building and publishing version $NEW_VERSION for git revision $GIT_REVISION..."

SUB_BUILD=PLATFORM ./gradlew clean composeBuild
SUB_BUILD=PLATFORM ./gradlew clean publish
VERSION=$NEW_VERSION GIT_REVISION=$GIT_REVISION docker-compose -f docker-compose.build.yaml build
VERSION=$NEW_VERSION GIT_REVISION=$GIT_REVISION docker-compose -f docker-compose.build.yaml push
echo "Completed building and publishing..."
Expand Down

0 comments on commit b6fe893

Please sign in to comment.