Skip to content

Commit

Permalink
create publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjenx committed Oct 30, 2024
1 parent 6887447 commit c85c774
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/deploy-to-github.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/deploy-to-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create and publish a release to Maven Central

on:
workflow_dispatch:
release:
types: [released] # Will trigger on (pre)released creation

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# - name: Import GPG Key
# uses: crazy-max/ghaction-import-gpg@v6
# env:
# GPG_PRIVATE_KEY: ${{ secrets.GPG_SIGNING_KEY }}
# PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Build and publish
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ github.event.release.name }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand Down Expand Up @@ -40,6 +41,14 @@ subprojects {
}
}
}
extensions.findByType<MavenPublishBaseExtension>()?.also { mavenPublishing ->
mavenPublishing.publishToMavenCentral(
SonatypeHost.CENTRAL_PORTAL,
automaticRelease = true
)


}
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
Expand Down

0 comments on commit c85c774

Please sign in to comment.