name: update version

on:
  push:
    branches:
      - master
      - beta

jobs:
  increment-build-number:
    runs-on: ubuntu-latest
    if: gitea.triggering_actor != 'ci'
    steps:
      - name: Pull & Checkout
        uses: actions/checkout@v3
        with:
          ref: develop

      - name: Bump build number
        id: increase_build_number
        uses: stikkyapp/update-pubspec-version@v1
        with:
          bump-build: true

      - name: Push to develop
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          file_pattern: pubspec.yaml
          branch: develop
          commit_user_name: ci
          commit_user_email: elias@elias-mueller.com
          commit_author: ci <elias@elias-mueller.com>
          commit_message: Automatic build number bump to ${{ steps.increase_build_number.outputs.new-version }}
