diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml new file mode 100644 index 0000000..1fd179b --- /dev/null +++ b/.github/workflows/publishing.yml @@ -0,0 +1,32 @@ +# 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 GitHub Packages +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: "17" + distribution: "temurin" + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 24aab46..77178f9 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -1,8 +1,27 @@ plugins { `java-library` + `maven-publish` id("com.diffplug.spotless") version "6.20.0" } +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/JarKz/TBot") + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") + } + } + } + publications { + register("gpr") { + from(components["java"]) + } + } +} + repositories { mavenCentral() } dependencies {