Skip to content

Commit 37979f7

Browse files
committed
Enable dynamic versioning on publish
1 parent 5f43849 commit 37979f7

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and release difflib-parser to PyPi
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
packages: read
13+
issues: read
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.13"
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
33+
- name: Build binary
34+
run: |
35+
echo "__version__ = \"${GITHUB_REF_NAME}\"" > src/difflib_parser/version.py
36+
python -m build
37+
38+
- name: Publish
39+
run: |
40+
python -m twine upload --username "__token__" --password ${{ secrets.PYPI_TOKEN }} --skip-existing --verbose dist/*

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ pythonpath = ["src"]
2828

2929
[tool.mypy]
3030
mypy_path = "src"
31+
32+
[tool.hatch.version]
33+
path = "src/difflib_parser/version.py"

src/difflib_parser/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.0"

0 commit comments

Comments
 (0)