Skip to content

Commit

Permalink
feat: added gradle publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JarKz committed Mar 7, 2024
1 parent bcf2c10 commit 11616a2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 19 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<MavenPublication>("gpr") {
from(components["java"])
}
}
}

repositories { mavenCentral() }

dependencies {
Expand Down

0 comments on commit 11616a2

Please sign in to comment.