From b488530106bf60631669e9993ccec991b841ef6a Mon Sep 17 00:00:00 2001 From: Jeremy Norman Date: Fri, 1 Mar 2024 09:16:54 +0100 Subject: [PATCH] chore: setup publishing to maven --- .github/workflows/publish.yml | 33 +++++++++++++++++++++++++++++++++ build.gradle.kts | 9 ++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0151541 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Publish package to the Maven Central Repository +on: + push: + tags: + - '*' +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + + - name: Publish package + run: ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 9256254..3128361 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,14 @@ allprojects { repositories { google() mavenCentral() - maven("https://jitpack.io") + maven { + name = "OSSRH" + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + } + } maven { url = uri("https://linphone.org/maven_repository/") }