Skip to content

Commit

Permalink
fix snapshot publication
Browse files Browse the repository at this point in the history
  • Loading branch information
xvik committed Dec 10, 2024
1 parent d891b05 commit ffc6d53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNAPSHOT: true
run: ./gradlew publishToGitHub --no-daemon
run: ./gradlew publishAllPublicationsToGitHubRepository --no-daemon
38 changes: 16 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ allprojects {
}
}
}

if (System.getenv("SNAPSHOT")) {
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle#publishing-packages-to-github-packages
publishing {
repositories {
maven {
name = "GitHub"
url = "https://maven.pkg.github.com/xvik/dropwizard-guicey"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
}

// don't publish gradle metadata artifact
javaLib.withoutGradleMetadata()

// skip signing for jitpack (snapshots)
tasks.withType(Sign) { onlyIf { !(System.getenv('JITPACK') || System.getenv('SNAPSHOT')) } }

if (System.getenv("SNAPSHOT")) {
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle#publishing-packages-to-github-packages
publishing {
repositories {
maven {
name = "GitHub"
url = "https://maven.pkg.github.com/xvik/dropwizard-guicey"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
}

// all sub-modules are normal java modules, using root BOM (like maven)
Expand Down Expand Up @@ -229,10 +229,4 @@ afterReleaseBuild {
doLast {
logger.warn "RELEASED $project.group:$project.name:$project.version"
}
}

tasks.register('publishToGitHub') {
description = 'Publish snapshot into GitHub repository'
dependsOn(':publishAllPublicationsToGitHubRepository')
dependsOn(subprojects.collect { ":$it.name:publishAllPublicationsToGitHubRepository" })
}

0 comments on commit ffc6d53

Please sign in to comment.