Skip to content

Commit

Permalink
Fetch tags so hatch-vcs can set the version number (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Oct 13, 2023
1 parent 38fcdad commit cbf5660
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v1

Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,3 @@ jobs:
with:
flags: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

release:
needs: test
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
cache: pip
cache-dependency-path: .github/workflows/main.yml
- name: Install tools
run: |
python -m pip install build twine
- name: Release
run: |
build .
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ dev = [
[project.scripts]
cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli"

[tool.hatch]
version.source = "vcs"
[tool.hatch.version]
source = "vcs"
# Change regex to match tags like "cherry-picker-v2.2.0".
tag-pattern = '^cherry-picker-(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

0 comments on commit cbf5660

Please sign in to comment.