From 74fb350b12a1f9f08495a62135d76d4ce53ab1c6 Mon Sep 17 00:00:00 2001 From: Raphael Zimmermann Date: Mon, 2 Jan 2023 19:51:09 +0100 Subject: [PATCH] Add release and publish workflow --- .github/workflows/release-and-publish.yml | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release-and-publish.yml 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