-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update gradle to 8.4. Migrate to new publishing flow, allowing for sn…
…apshots and release using actions
- Loading branch information
Showing
7 changed files
with
174 additions
and
114 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,60 @@ | ||
name: Build and deploy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
release: | ||
types: [ published ] | ||
|
||
env: | ||
GRADLE_USER_HOME: .gradle | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- name: Upload all output libs | ||
uses: actions/[email protected] | ||
with: | ||
name: output-libs | ||
path: "*/build/libs" | ||
|
||
- name: Snapshot build deploy | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx' | ||
run: ./gradlew build publish | ||
env: | ||
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
|
||
- name: Import GPG key | ||
if: github.event_name == 'release' && github.repository_owner == 'libgdx' | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@1c6a9e9d3594f2d743f1b1dd7669ab0dfdffa922 | ||
with: | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Release build deploy | ||
if: github.event_name == 'release' && github.repository_owner == 'libgdx' | ||
run: ./gradlew build publish -PRELEASE -Psigning.gnupg.keyId=${{ secrets.GPG_KEYID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Psigning.gnupg.keyName=${{ secrets.GPG_KEYID }} | ||
env: | ||
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
org.gradle.daemon=true | ||
org.gradle.jvmargs=-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8 | ||
org.gradle.configureondemand=false | ||
|
||
group=com.badlogicgames.gdx | ||
version=1.8.3 | ||
POM_DESCRIPTION=AI algorithms for libGDX | ||
POM_NAME=libGDX AI | ||
POM_URL=https://github.com/libgdx/gdx-ai | ||
POM_SCM_URL=https://github.com/libgdx/gdx-ai | ||
POM_SCM_CONNECTION=scm:[email protected]:libgdx/gdx-ai.git | ||
POM_SCM_DEV_CONNECTION=scm:[email protected]:libgdx/gdx-ai.git | ||
POM_LICENCE_NAME=The Apache Software License, Version 2.0 | ||
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt | ||
POM_LICENCE_DIST=repo |
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,110 +1,75 @@ | ||
import org.gradle.api.XmlProvider | ||
import org.gradle.api.artifacts.maven.MavenDeployment | ||
|
||
apply plugin: 'maven' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
group = 'com.badlogicgames.gdx' | ||
version = '1.8.3' | ||
ext.packaging = 'jar' | ||
|
||
def isDevBuild | ||
def isCiBuild | ||
def isReleaseBuild | ||
|
||
def sonatypeRepositoryUrl | ||
|
||
//set build variables based on build type (release, continuous integration, development) | ||
if(hasProperty("release")) { | ||
isReleaseBuild = true | ||
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
println "Performing release build" | ||
} else if (hasProperty("snapshot")) { | ||
isCiBuild = true | ||
version += "-SNAPSHOT" | ||
sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
println "Performing snapshot build" | ||
} else { | ||
isDevBuild = true | ||
version += "-SNAPSHOT" | ||
println "Performing local build" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
task artifactDocs(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from 'build/docs/javadoc' | ||
} | ||
|
||
task artifactSources(type: Jar) { | ||
from sourceSets.main.allSource | ||
classifier = 'sources' | ||
} | ||
|
||
artifacts { | ||
archives jar | ||
archives artifactDocs | ||
archives artifactSources | ||
} | ||
|
||
if(isReleaseBuild) { | ||
signing { | ||
sign configurations.archives | ||
} | ||
} else { | ||
task signArchives { | ||
// do nothing | ||
} | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
if (isDevBuild) { | ||
mavenLocal() | ||
} | ||
else { | ||
mavenDeployer { | ||
if(isReleaseBuild) { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
afterEvaluate { project -> | ||
publishing { | ||
publications { | ||
withType(MavenPublication) { | ||
pom { | ||
name = POM_NAME | ||
description = POM_DESCRIPTION | ||
url = POM_URL | ||
licenses { | ||
license { | ||
name = POM_LICENCE_NAME | ||
url = POM_LICENCE_URL | ||
distribution = POM_LICENCE_DIST | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "davebaol" | ||
name = "davebaol" | ||
} | ||
} | ||
scm { | ||
connection = POM_SCM_CONNECTION | ||
developerConnection = POM_SCM_DEV_CONNECTION | ||
url = POM_SCM_URL | ||
} | ||
} | ||
|
||
repository(url: sonatypeRepositoryUrl) { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
//Check if we are a gradle plugin, if we are skip mavenJava | ||
if (!plugins.hasPlugin('java-gradle-plugin')) { | ||
mavenJava(MavenPublication) { | ||
|
||
from components.java | ||
versionMapping { | ||
usage('java-api') { | ||
fromResolutionOf('runtimeClasspath') | ||
} | ||
usage('java-runtime') { | ||
fromResolutionResult() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
pom.version = version | ||
pom.packaging = 'jar' | ||
|
||
pom.project { | ||
name 'libGDX AI' | ||
description 'AI algorithms for libGDX' | ||
url 'https://github.com/libgdx/gdx-ai' | ||
repositories { | ||
maven { | ||
url = version.endsWith('SNAPSHOT') ? getSnapshotRepositoryUrl() : getReleaseRepositoryUrl() | ||
|
||
scm { | ||
url 'scm:[email protected]:libgdx/gdx-ai.git' | ||
connection 'scm:[email protected]:libgdx/gdx-ai.git' | ||
developerConnection 'scm:[email protected]:libgdx/gdx-ai.git' | ||
} | ||
if (getRepositoryUsername() || getRepositoryPassword()) { | ||
credentials { | ||
username = getRepositoryUsername() | ||
password = getRepositoryPassword() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
signing { | ||
useGpgCmd() | ||
sign publishing.publications | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'davebaol' | ||
name 'davebaol' | ||
} | ||
} | ||
} | ||
} | ||
//Simply using "required" in signing block doesn't work because taskGraph isn't ready yet. | ||
gradle.taskGraph.whenReady { | ||
tasks.withType(Sign) { | ||
onlyIf { isReleaseBuild() } | ||
} | ||
} | ||
} | ||
} |
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