Skip to content

Commit

Permalink
publish to maven repo
Browse files Browse the repository at this point in the history
  • Loading branch information
codeconsole committed Dec 13, 2024
1 parent bbcb251 commit 0ab960f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ jobs:
# uses: gradle/gradle-build-action@v2
- name: Restore gradle.properties
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
MAVEN_PUBLISH_USERNAME: ${{ secrets.GITHUB_ACTOR }}
MAVEN_PUBLISH_PASSWORD: ${{ secrets.GH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
SECRET_KEY_RING_FILE: ${{ github.workspace }}/secring.gpg
shell: bash
run: |
mkdir -p ~/.gradle/
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=${HOME}/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo ${GPG_SIGNING_KEY} | base64 -d > ~/.gradle/secring.gpg
echo ${GPG_SIGNING_KEY} | base64 -d > ${SECRET_KEY_RING_FILE}
- name: Run build with Gradle Wrapper
run: ./gradlew test publishToSonatype
run: ./gradlew test publish
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ java {
// https://docs.gradle.org/current/userguide/java_library_plugin.html#:~:text=The%20api%20configuration%20should%20be,are%20internal%20to%20the%20component.
// https://dev.to/art_ptushkin/gradle-maven-scopes-cheat-sheet-4i56
publishing {
repositories {
maven {
credentials {
username = System.getenv('MAVEN_PUBLISH_USERNAME') ?: ''
password = System.getenv('MAVEN_PUBLISH_PASSWORD') ?: ''
}
url = 'https://maven.pkg.github.com/codeconsole/grails-plugin-sitemesh3'
}
}
publications {
maven(MavenPublication) {
from components.java
Expand Down Expand Up @@ -165,6 +174,16 @@ publishing {
}
}

println "***** ${(System.getenv('SIGNING_KEY_ID') ?: '').size()} << length "
println "***** ${(System.getenv('SIGNING_KEY_ID') ?'VALID': 'BLANK')}"
println "***** ${(System.getenv('SIGNING_PASSWORD') ?: '').size()} << length "
println "***** ${(System.getenv('SECRET_KEY_RING_FILE') ?: '').size()} << length "
//signing {
signing.keyId=(System.getenv('SIGNING_KEY_ID') ?: '')
signing.password=System.getenv('SIGNING_PASSWORD') ?: ''
signing.secretKeyRingFile=System.getenv('SECRET_KEY_RING_FILE') ?: ''


signing {
sign publishing.publications.maven
}
Expand Down

0 comments on commit 0ab960f

Please sign in to comment.