feat: redo the package (#4) #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/auto-pyproject-update.yml | |
| name: Auto update pyproject | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install editor deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tomlkit | |
| - name: Decide bump level from commit message | |
| id: decide | |
| run: | | |
| msg="$(git log -1 --pretty=%B)" | |
| level="patch" | |
| if echo "$msg" | grep -qi "breaking change"; then level="major"; fi | |
| if echo "$msg" | grep -qi "^feat:"; then level="minor"; fi | |
| echo "level=$level" >> "$GITHUB_OUTPUT" | |
| - name: Bump version | |
| run: | | |
| python scripts/pyproject_editor.py bump-version "${{ steps.decide.outputs.level }}" | |
| - name: Commit & push if changed | |
| run: | | |
| if ! git diff --quiet; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add pyproject.toml | |
| git commit -m "chore: bump version (${{ steps.decide.outputs.level }}) [skip ci]" | |
| git push | |
| fi |