Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to maven central #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
env:
sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.P_KEY_ARMORED }}
SIGNING_PASSWORD: ${{ secrets.P_KEY_PASSPHRASE }}

steps:
- uses: actions/checkout@v2
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Deploy
run: ./gradlew publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository
25 changes: 1 addition & 24 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,7 @@ gradle-app.setting
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries
.idea

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
Expand All @@ -59,9 +39,6 @@ gradle-app.setting
# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

Expand Down
83 changes: 82 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'

id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

group = 'net.minestom'
version = '1.0.0'
version = '1.0.1'

repositories {
mavenCentral()
}

dependencies {
implementation 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:3.1.4'
testImplementation(
Expand All @@ -19,6 +25,81 @@ dependencies {
test {
useJUnitPlatform()
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}

task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar, javadocJar
}

// Publishing

publishing {
publications {
release(MavenPublication) {
from project.components.java
artifact javadocJar
artifact sourcesJar

pom {
name = 'dependencygetter'
description = 'Abstraction layer over dependencies. Made with Minestom extensions in mind.'
url = 'https://github.com/Minestom/DependencyGetter'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/Minestom/DependencyGetter/blob/master/LICENSE.md'
}
}

scm {
connection = 'scm:git:github.com/Minestom/DependencyGetter.git'
developerConnection = 'scm:git:ssh://github.com/Minestom/DependencyGetter.git'
url = 'https://github.com/Minestom/DependencyGetter/tree/master'
}

developers {
developer {
id = 'minestom'
name = 'Minestom Contributors'
email = '[email protected]'
}
}
}
}
}
}

nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")

username = System.getenv("sonatypeUsername") ?: hasProperty("sonatypeUsername") ? sonatypeUsername : ''
password = System.getenv("sonatypePassword") ?: hasProperty("sonatypePassword") ? sonatypePassword : ''
}
}
}

// Signing

signing {
if (System.env['CI'] != null) {
def signingKey = System.env['SIGNING_KEY']
def signingPassword = System.env['SIGNING_PASSWORD']
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists