name: version update
on:
  release:
    types: [published]

jobs:
  version-update:
    name: Update version.txt after last release
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Get current tag  
        id: tagger
        uses: jimschubert/query-tag-action@v1

      - name: Update version.txt file
        run: echo ${{ steps.tagger.outputs.tag  }} > version.txt

      - name: Commit modified file
        uses: EndBug/add-and-commit@v9
        with:
          add: 'version.txt'
          message: 'Update version, tag and latest commit hash'
