Skip to content

Commit

Permalink
add publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Feb 18, 2024
1 parent b90ccf0 commit aa2ccda
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 150 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: publish

on:
push:
branches: [ main ]
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: ./gradlew publishIfNeeded
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
COM_GRADLEUP_PROFILE_ID: ${{ secrets.COM_GRADLEUP_PROFILE_ID }}
17 changes: 0 additions & 17 deletions build-logic/src/main/kotlin/jvmTarget.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@

import EnvVarKeys.Nexus.username
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import net.mbonnin.vespene.lib.NexusStagingClient
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.UnknownDomainObjectException
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.logging.LogLevel
import org.gradle.api.plugins.ExtensionContainer
import org.gradle.api.provider.Provider
import org.gradle.api.publish.PublicationContainer
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import kotlin.time.Duration.Companion.minutes

fun Project.targetJdk(jdk: Int) {
tasks.withType(JavaCompile::class.java) {
Expand Down
6 changes: 0 additions & 6 deletions build-logic/src/main/kotlin/lib.kt

This file was deleted.

43 changes: 43 additions & 0 deletions build-logic/src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import org.gradle.api.Project

val sonatypeOptions = System.getenv("OSSRH_USER")?.let {
SonatypeOptions(
username = it,
password = System.getenv("OSSRH_PASSWORD") ?: error("OSSRH_PASSWORD not found"),
host = SonatypeHost.Ossrh,
stagingProfile = System.getenv("COM_GRADLEUP_PROFILE_ID") ?: error("COM_GRADLEUP_PROFILE_ID not found"),
)
}

fun Project.configureLib() {
targetJdk(11)

configurePublishing(
projectOptions = ProjectOptions(
groupId = "com.gradleup.gratatouille",
version = "0.0.1",
descriptions = "Cook yourself delicious Gradle plugins",
vcsUrl = "https://github.com/GradleUp/gratatouille",
developers = "GradleUp authors",
license = "MIT License",
licenseUrl = "https://github.com/GradleUp/gratatouille/blob/main/LICENSE"
),
sonatypeOptions = sonatypeOptions,
signingOptions = System.getenv("GPG_KEY")?.let {
SigningOptions(
privateKey = it,
privateKeyPassword = System.getenv("GPG_KEY_PASSWORD") ?: error("GPG_KEY_PASSWORD not found")
)
},
)
}

fun Project.configureRoot() {
configureGitHub(
sonatypeOptions = sonatypeOptions,
githubOptions = GithubOptions(
mainBranch = "main",
autoRelease = false
)
)
}
Loading

0 comments on commit aa2ccda

Please sign in to comment.