-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDKJAVA-136 Github CI for Gradle Resolver
Signed-off-by: Oleksandr Vyshniak <[email protected]>
- Loading branch information
Showing
10 changed files
with
226 additions
and
4 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,14 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
export GPG_TTY=$(tty) | ||
|
||
gpg --version | ||
|
||
export ORG_GRADLE_PROJECT_asciiArmoredSigningKey=$(echo $GPG_PRIVATE_KEY | base64 -d) | ||
export ORG_GRADLE_PROJECT_signingPassword=$GPG_PASSPHRASE | ||
export ORG_GRADLE_PROJECT_ossrhUsername=$OSSRH_USERNAME | ||
export ORG_GRADLE_PROJECT_ossrhPassword=$OSSRH_PASSWORD | ||
|
||
RELEASE_TAG=$(git describe --abbrev=0) | ||
./gradlew clean publish closeAndReleaseStagingRepositories -PprojVersion=$RELEASE_TAG --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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
# Prepare release | ||
PREVIOUS_RELEASE_TAG=$(git describe --abbrev=0) | ||
if [[ $PREVIOUS_RELEASE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
# Set current released version | ||
RELEASE_TAG=$(echo ${PREVIOUS_RELEASE_TAG} | awk -F. -v OFS=. '{$NF += 1 ; print}') | ||
else | ||
echo "Cannot parse the latest release tag: ${PREVIOUS_RELEASE_TAG}" | ||
exit 1 | ||
fi | ||
|
||
git config user.name "GitHub CI" | ||
git config user.email "[email protected]" | ||
|
||
git tag -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG} from build ${GITHUB_JOB}" | ||
|
||
git push origin --tags |
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,32 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip release]')" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: master | ||
fetch-depth: 0 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- name: Test | ||
run: ./gradlew test | ||
- name: Push git tag | ||
run: .github/scripts/push-tag.sh | ||
- name: Deploy Release | ||
env: | ||
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_KEY }} | ||
run: .github/scripts/deploy.sh |
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,27 @@ | ||
name: Test | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on pull request events but only for the master branch | ||
pull_request: | ||
branches: [ master ] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- name: Validate | ||
run: ./gradlew spotlessCheck | ||
- name: Test | ||
run: ./gradlew test |
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 |
---|---|---|
|
@@ -3,21 +3,31 @@ plugins { | |
id 'maven-publish' | ||
id 'groovy' | ||
id 'groovy-gradle-plugin' | ||
id "com.diffplug.spotless" version "6.13.0" | ||
id 'com.diffplug.spotless' version '6.13.0' | ||
id 'signing' | ||
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
group = "com.here.platform.artifact" | ||
group = "com.here.platform.artifact.gradle" | ||
|
||
version = "0.0.1-SNAPSHOT" | ||
if (project.hasProperty('projVersion')) { | ||
project.version = project.projVersion | ||
} else { | ||
project.version = '0.0.1-SNAPSHOT' | ||
} | ||
|
||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
dependencies { | ||
|
@@ -36,10 +46,14 @@ test { | |
} | ||
|
||
gradlePlugin { | ||
vcsUrl = "https://github.com/heremaps/here-artifact-gradle-resolver" | ||
website = "https://github.com/heremaps/here-artifact-gradle-resolver" | ||
plugins { | ||
create("hereArtifactResolver") { | ||
id = "com.here.platform.artifact.gradle" | ||
implementationClass = "com.here.platform.artifact.gradle.ArtifactResolver" | ||
displayName = "HERE platform Gradle Resolver plugin" | ||
description = "The HERE platform Gradle resolver plugin provides Java and Scala developers with access to HERE platform artifacts via Gradle" | ||
} | ||
} | ||
} | ||
|
@@ -49,4 +63,56 @@ spotless { | |
target '**/*.java' | ||
eclipse().configFile(rootProject.file('codestyle-formatter-settings.xml')) | ||
} | ||
} | ||
|
||
publishing { | ||
afterEvaluate { | ||
publications { | ||
withType(MavenPublication) { | ||
pom { | ||
name = "HERE platform Gradle Resolver plugin" | ||
url = "https://github.com/heremaps/here-artifact-gradle-resolver" | ||
description = "The HERE platform Gradle resolver plugin provides Java and Scala developers with access to HERE platform artifacts via Gradle" | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
scm { | ||
connection = "scm:https://github.com/heremaps/here-artifact-gradle-resolver.git" | ||
developerConnection = "scm:[email protected]:heremaps/here-artifact-gradle-resolver.git" | ||
url = "https://github.com/heremaps/here-artifact-gradle-resolver" | ||
} | ||
developers { | ||
developer { | ||
name = "HERE Artifact Service Team" | ||
email = "[email protected]" | ||
organization = "HERE Europe B.V." | ||
organizationUrl = "https://github.com/heremaps" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
required { isReleaseVersion } | ||
def signingKey = findProperty("asciiArmoredSigningKey") | ||
def signingPassword = findProperty("signingPassword") | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/")) | ||
username.set(project.properties["ossrhUsername"].toString()) | ||
password.set(project.properties["ossrhPassword"].toString()) | ||
} | ||
} | ||
} |
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