Merge pull request #690 from zwimer/support_oxford_comma #585
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: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set Tag env | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Upgrade pip | |
| run: | | |
| pip install --constraint=.github/workflows/constraints.txt pip | |
| pip --version | |
| - name: Install Hatch | |
| run: | | |
| pip install --constraint=.github/workflows/hatch-constraints.txt hatch | |
| hatch --version | |
| - name: Check if there is a parent commit | |
| id: check-parent-commit | |
| run: | | |
| echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" | |
| - name: Detect and tag new version | |
| id: check-version | |
| if: steps.check-parent-commit.outputs.sha | |
| uses: salsify/action-detect-and-tag-new-version@v2 | |
| with: | |
| version-command: | | |
| bash -o pipefail -c "hatch version" | |
| - name: Bump version for developmental release | |
| if: "! steps.check-version.outputs.tag" | |
| run: | | |
| hatch version b | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Build package | |
| run: | | |
| uv build | |
| - name: Publish package on PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} | |
| - name: Publish the release notes | |
| uses: release-drafter/release-drafter@v6 | |
| with: | |
| tag: ${{ env.RELEASE_VERSION }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |