Skip to content

Commit

Permalink
Add publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
panpeter committed Jul 13, 2022
1 parent 755d071 commit 5a1bf6f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish package
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 11 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ tasks.withType<Test>().configureEach {
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/doist/detekt-rules")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("mavenJava") {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
Expand Down

0 comments on commit 5a1bf6f

Please sign in to comment.