diff --git a/.github/workflows/release-and-publish.yml b/.github/workflows/release-and-publish.yml new file mode 100644 index 0000000..a85b1fc --- /dev/null +++ b/.github/workflows/release-and-publish.yml @@ -0,0 +1,41 @@ +name: Create github release and publish to OSSRH + +on: + push: + tags: + - 'v*' + +jobs: + release-and-publish: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + - name: Get the version + id: get_version + run: | + echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release v${{ env.version }} + draft: false + prerelease: false + - name: Publish package to OSSRH + uses: gradle/gradle-build-action@v2 + with: + arguments: publishToSonatype printVersion + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHARASE }} + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} \ No newline at end of file