Skip to content

Commit

Permalink
Move signing to signPlugin task
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Nov 20, 2024
1 parent d5dbc33 commit 8eafbda
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
DELTACV_PLUGINSIGNING_PRIVATE: ${{ secrets.DELTACV_PLUGINSIGNING_PRIVATE }}
PLUGINSIGNING_PRIVATE: ${{ secrets.DELTACV_PLUGINSIGNING_PRIVATE }}
run: |
./gradlew :Shared:publishToMavenCentral :PaperVision:publishToMavenCentral :LwjglPlatform:publishToMavenCentral :EOCVSimPlugin:publishToMavenCentral --no-configuration-cache -x test -x :EOCVSimPlugin:shadowJar
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Build dev shadow jar with Gradle
env:
DELTACV_PLUGINSIGNING_PRIVATE: ${{ secrets.DELTACV_PLUGINSIGNING_PRIVATE }}
PLUGINSIGNING_PRIVATE: ${{ secrets.DELTACV_PLUGINSIGNING_PRIVATE }}
run: |
SHA_SHORT="$(git rev-parse --short HEAD)"
./gradlew -Phash=$SHA_SHORT shadowJar -x test
Expand Down
21 changes: 18 additions & 3 deletions EOCVSimPlugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ plugins {

apply from: '../build.common.gradle'

tasks.matching { it.name == "jar" || it.name == "shadowJar"}.configureEach {
tasks.register('signPlugin') {
doLast {
// Get the key from an environment variable
def signingKey = System.getenv('DELTACV_PLUGINSIGNING_PRIVATE')
if (!signingKey) {
println("Environment variable 'DELTACV_PLUGINSIGNING_PRIVATE' is not set.")
println("Environment variable 'PLUGINSIGNING_PRIVATE' is not set.")
return
}

def jarFile = archiveFile.get().asFile.absolutePath
// Get the jar file path (assuming the task is executed after the jar task)
def jarFile = tasks.named("jar").get().archiveFile.get().asFile.absolutePath
def commonJarPath = rootDir.absolutePath + File.separator + "tools" + File.separator + "Common.jar"

println("Signing plugin. Using common jar: ${commonJarPath}")
Expand All @@ -37,6 +38,20 @@ tasks.matching { it.name == "jar" || it.name == "shadowJar"}.configureEach {
}
}

tasks.named("jar").configure {
finalizedBy signPlugin
}

tasks.named("shadowJar").configure {
finalizedBy signPlugin
}

tasks.configureEach {
if (name == "generateMetadataFileForMavenPublication") {
dependsOn signPlugin
}
}

shadowJar {
configurations = [project.configurations.runtimeClasspath]

Expand Down

0 comments on commit 8eafbda

Please sign in to comment.