Skip to content

Commit

Permalink
Add workflow for publishing artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticfall committed Oct 25, 2021
1 parent 1cafb03 commit 7d11b03
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish Package to OSS Sonatype Repository
on:
push:
branches: [ main ]
release:
types:
- created

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Install Dependencies
run: sudo apt update && sudo apt install -y gnupg2

- 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: Perform Tests
run: gradle check

- name: Import GPG Key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Publish Package
run: |
gradle publish \
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} \
-PossrhPassword=${{ secrets.OSSRH_TOKEN }} \
-Psigning.gnupg.keyName=${{ secrets.OSSRH_GPG_KEY }} \
-Psigning.gnupg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ publishing {
}

signing {
// setRequired({
// gradle.taskGraph.hasTask("publish")
// })
setRequired({
gradle.taskGraph.hasTask("publish")
})

useGpgCmd()

Expand Down

0 comments on commit 7d11b03

Please sign in to comment.