Skip to content

Commit

Permalink
try snapshotting
Browse files Browse the repository at this point in the history
  • Loading branch information
zmarkan committed Jun 4, 2024
1 parent f5b6837 commit 068b2d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/gradle-publish-nightly-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ jobs:
echo "ORG_GRADLE_PROJECT_LIBRARY_VERSION=`git tag | tail -1`-SNAPSHOT" >> $GITHUB_ENV
# This step is needed because Gradle doesn't like to see GPG keys from env vars (for reasons unbeknownst to me)
- name: Inject Gradle signing key from GHA secret
run: |
echo $GPG_SIGNING_KEY \
| awk 'NR == 1 { print "SIGNING_KEY=" } 1' ORS='\\n' \
>> gradle.properties
# - name: Inject Gradle signing key from GHA secret
# run: |
# echo $GPG_SIGNING_KEY \
# | awk 'NR == 1 { print "SIGNING_KEY=" } 1' ORS='\\n' \
# >> gradle.properties

- name: Publish snapshots to Maven Central
env:
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY: ${{ secrets.ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY_PWD: ${{ secrets.ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY_PWD }}

run: |
./gradlew publishToSonatype
15 changes: 10 additions & 5 deletions .github/workflows/gradle-publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ jobs:
source $GITHUB_ENV
# This step is needed because Gradle doesn't like to see GPG keys from env vars (for reasons unbeknownst to me)
- name: Inject Gradle signing key from GHA secret
run: |
echo $GPG_SIGNING_KEY \
| awk 'NR == 1 { print "SIGNING_KEY=" } 1' ORS='\\n' \
>> gradle.properties
# - name: Inject Gradle signing key from GHA secret
# run: |
# echo $GPG_SIGNING_KEY \
# | awk 'NR == 1 { print "SIGNING_KEY=" } 1' ORS='\\n' \
# >> gradle.properties

# add closeAndReleaseSonatypeStagingRepository to below to automate the whole process.
- name: Publish to Maven Central
env:
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY: ${{ secrets.ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY_PWD: ${{ secrets.ORG_GRADLE_PROJECT_GPG_SIGNING_IN_MEMORY_KEY_PWD }}
run: |
./gradlew assemble publishToSonatype
8 changes: 4 additions & 4 deletions gradle/deploy.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

def signingKey = findProperty("signingInMemoryKey")
def signingPassword = findProperty("signingInMemoryKeyPassword")
def signingKey = findProperty("GPG_SIGNING_IN_MEMORY_KEY")
def signingPassword = findProperty("GPG_SIGNING_IN_MEMORY_KEY_PWD")

signing {
useInMemoryPgpKeys(signingKey, signingPassword)
Expand Down Expand Up @@ -60,8 +60,8 @@ afterEvaluate {
repositories {
maven {
credentials {
username = findProperty("mavenCentralUsername")
password = findProperty("mavenCentralPassword")
username = findProperty("MAVEN_CENTRAL_USERNAME")
password = findProperty("MAVEN_CENTRAL_PASSWORD")
}

def releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
Expand Down

0 comments on commit 068b2d1

Please sign in to comment.