Skip to content

Commit

Permalink
build(CI): add maven publish on release
Browse files Browse the repository at this point in the history
  • Loading branch information
ebuildy committed Jan 14, 2022
1 parent a1ad947 commit f6e3af2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release-maven.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish package
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: publish
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Build with Gradle
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: djobiAssemble -x test
arguments: -Prelease.useLastTag=true djobiAssemble -x test
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
9 changes: 5 additions & 4 deletions djobi-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ publishing {

repositories {
maven {
name = "OSSRH"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

credentials {
username = "$usr"
password = "$pwd"
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}

url = "https://maven.pkg.jetbrains.space/mycompany/p/projectkey/my-maven-repo"
}
}
}
Expand Down

0 comments on commit f6e3af2

Please sign in to comment.