Skip to content
Merged
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
38 changes: 6 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,36 +179,10 @@ jobs:
- name: Set version from tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Publish to local repository
- name: Publish to Maven Central
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publishPluginMavenPublicationToLocalRepoRepository

- name: Create bundle
run: |
cd build/local-repo
find . -type f -name "*.asc" -o -name "*.jar" -o -name "*.pom" | sort
zip -r ../central-bundle.zip .
cd ..
ls -lh central-bundle.zip

- name: Verify bundle structure
run: |
echo "Bundle contents:"
unzip -l build/central-bundle.zip
echo ""
echo "Bundle size:"
ls -lh build/central-bundle.zip

- name: Upload to Central Portal
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
run: |
curl --fail -v -X POST \
-H "Authorization: Bearer $(echo -n ${SONATYPE_USERNAME}:${SONATYPE_PASSWORD} | base64)" \
-F "file=@build/central-bundle.zip" \
-F "name=mapstruct-plugin-${{ github.ref_name }}" \
-F "publishingType=AUTOMATIC" \
https://central.sonatype.com/api/v1/publisher/upload
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publishToMavenCentral
74 changes: 28 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ plugins {
id 'com.gradle.plugin-publish' version '2.1.1'
id 'io.freefair.lombok' version '9.5.0'
id 'org.sonarqube' version '7.3.1.8318'
id 'com.vanniktech.maven.publish' version '0.37.0'
id 'java-gradle-plugin'
id 'maven-publish'
id 'signing'
id 'jacoco'
}

Expand Down Expand Up @@ -72,7 +71,6 @@ java {
sourceCompatibility = 17
targetCompatibility = 17
withSourcesJar()
withJavadocJar()
}

jacocoTestReport {
Expand All @@ -93,55 +91,39 @@ sonarqube {
}
}

publishing {
publications {
pluginMaven(MavenPublication) {
pom {
name = 'MapStruct Plugin'
description = 'Automatic MapStruct configuration for Gradle'
url = 'https://github.com/AkaZver/mapstruct-plugin'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id = 'akazver'
name = 'Vasiliy Sobolev'
email = 'aka.zver.007@gmail.com'
url = 'https://github.com/AkaZver'
}
}

scm {
connection = 'scm:git:git://github.com/AkaZver/mapstruct-plugin.git'
developerConnection = 'scm:git:ssh://github.com/AkaZver/mapstruct-plugin.git'
url = 'https://github.com/AkaZver/mapstruct-plugin'
}
mavenPublishing {
publishToMavenCentral(true)
signAllPublications()

pom {
name = 'MapStruct Plugin'
description = 'Automatic MapStruct configuration for Gradle'
inceptionYear = '2021'
url = 'https://github.com/AkaZver/mapstruct-plugin'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}

repositories {
maven {
name = 'localRepo'
url = layout.buildDirectory.dir('local-repo')
developers {
developer {
id = 'akazver'
name = 'Vasiliy Sobolev'
email = 'aka.zver.007@gmail.com'
url = 'https://github.com/AkaZver'
}
}
}
}

signing {
def signingKey = System.getenv("SIGNING_KEY")
def signingPassword = System.getenv("SIGNING_PASSWORD")
required = signingKey != null && !version.toString().endsWith('SNAPSHOT')
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
scm {
url = 'https://github.com/AkaZver/mapstruct-plugin'
connection = 'scm:git:git://github.com/AkaZver/mapstruct-plugin.git'
developerConnection = 'scm:git:ssh://github.com/AkaZver/mapstruct-plugin.git'
}
}
sign publishing.publications.pluginMaven
}

javadoc {
Expand Down