diff --git a/.github/workflows/new_tag.yml b/.github/workflows/new_tag.yml new file mode 100644 index 0000000..27fe1ca --- /dev/null +++ b/.github/workflows/new_tag.yml @@ -0,0 +1,42 @@ +name: Tag on version bump + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + tag: + name: Create tag if version changed + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get current version from pyproject.toml + id: current + run: | + VERSION=$(grep '^version =' pyproject.toml | cut -d '"' -f2) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Get previous version from main~1 + id: previous + run: | + git checkout HEAD~1 + PREV_VERSION=$(grep '^version =' pyproject.toml | cut -d '"' -f2) + echo "version=$PREV_VERSION" >> $GITHUB_OUTPUT + + - name: Compare versions and create tag if changed + if: steps.current.outputs.version != steps.previous.outputs.version + run: | + git config user.name "github-actions[bot]" + + TAG="v${{ steps.current.outputs.version }}" + git tag "$TAG" + git push origin "$TAG" diff --git a/Makefile b/Makefile index f1ebdfb..54a3139 100644 --- a/Makefile +++ b/Makefile @@ -59,9 +59,9 @@ runBuild: $(UVE) build runBump: - cz bump --files-only --yes --changelog + $(UVE) run cz bump --files-only --yes --changelog git add . - cz version --project | xargs -i git commit -am "bump: release {}" + $(UVE) run cz version --project | xargs -i git commit -am "bump: release {}" runUV: $(UVE) run $(CMD) diff --git a/lefthook.yml b/lefthook.yml index 94c22eb..95bc29d 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -62,7 +62,7 @@ pre-commit: stage_fixed: true - name: ruff glob: "*.py" - run: \[\[ test $RUFF != "" ]] && $RUFF check {staged_files} --fix || ruff check {staged_files} --fix + run: ruff check {staged_files} --fix stage_fixed: true - name: uv-export run: make runLock && git add \*/requirements\*\.txt