name: Next Dev Version

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Change Version
      run: |
        snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
        plainVersion=${snapshotVersion%-SNAPSHOT}
        nextPlainVersion=$( echo $plainVersion | awk -F. '/[0-9]+\./{$NF++;print}' OFS=. )
        nextVersion=${nextPlainVersion}-SNAPSHOT
        sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
    - name: Commit Next Dev Changes
      uses: jvalkeal/build-zoo-handler@v0.0.4
      with:
        commit-changes-branch: 3.1.x
        commit-changes-message: Next development version
