diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yml similarity index 60% rename from .github/workflows/publish.yml rename to .github/workflows/release.yml index 798ebb5..8900864 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,24 @@ -name: Publish to Maven Central +name: Release on: - release: - types: [ created ] + workflow_dispatch: + inputs: + force-major: + description: 'Force major version bump' + required: false + type: boolean + default: false jobs: - publish: + release: runs-on: ubuntu-latest permissions: - contents: read + contents: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v4 @@ -22,6 +29,14 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 + - name: Calculate and create tag + id: version + uses: mathieudutour/github-tag-action@v6.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + default_bump: ${{ inputs.force-major && 'major' || 'patch' }} + release_branches: master + - name: Build with Gradle run: ./gradlew build @@ -39,6 +54,14 @@ jobs: JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }} JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ steps.version.outputs.new_tag }}" \ + --title "${{ steps.version.outputs.new_tag }}" \ + --generate-notes + - name: Upload JReleaser logs if: always() uses: actions/upload-artifact@v4