Release #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version to release (which will also be used for the tag)' | |
required: true | |
type: string | |
permissions: | |
contents: write # To write the version change to the repository | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Update version in gradle.properties | |
run: | | |
sed -i "s/^version=.*$/version=$VERSION/" gradle.properties | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add gradle.properties | |
git commit -m "Set version to $VERSION" | |
git tag -a $VERSION -m "Release $VERSION" | |
./gradlew publishToSonatype --no-daemon | |
./gradlew :incrementVersion --no-daemon | |
git add gradle.properties | |
git commit -m "Update to next development version" | |
git push | |
git push --tags | |
./gradlew closeAndReleaseSonatypeStagingRepository | |
env: | |
VERSION: ${{ inputs.version }} | |
OSSRH_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ inputs.version }} | |
run: | | |
gh release create "$VERSION" --generate-notes |