release #2
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
| name: release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| type: choice | |
| options: [major, minor, patch] | |
| default: patch | |
| permissions: | |
| contents: write | |
| jobs: | |
| prepare: | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - uses: actions/setup-python@v5 | |
| with: { python-version: "3.10" } | |
| - run: | | |
| python -m pip install --upgrade pip requests | |
| chmod +x scripts/bump_version.py | |
| - id: bump | |
| run: | | |
| NEWVER=$(python scripts/bump_version.py "${{ inputs.bump }}") | |
| echo "new_version=$NEWVER" >> $GITHUB_OUTPUT | |
| echo "Version -> $NEWVER" | |
| - name: commit + tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add pyproject.toml || true | |
| git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }}" || true | |
| git push origin main | |
| git tag -a "v${{ steps.bump.outputs.new_version }}" -m "release v${{ steps.bump.outputs.new_version }}" | |
| git push origin "v${{ steps.bump.outputs.new_version }}" |