name: Change versions
on:
  pull_request:
    types: [opened, synchronize, reopened]
    paths:
      - "version.txt"
jobs:
  change_version:
    runs-on: ubicloud
    container: node:18
    steps:
      - uses: actions/checkout@v3
      - run: git config --system --add safe.directory /__w/windmill/windmill
      - name: Change versions
        run: ./.github/change-versions.sh "$(cat version.txt)"
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
      - name: update lockfile
        run: cd backend && cargo generate-lockfile
      - uses: stefanzweifel/git-auto-commit-action@v4
