Skip to content

Commit dddbf1a

Browse files
committed
Automatically set version on publish
1 parent 49617c5 commit dddbf1a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- name: Set version in manifest.json
20+
run: |
21+
# Extract version from tag (e.g., "refs/tags/v1.2.3" becomes "1.2.3")
22+
version="${GITHUB_REF#refs/tags/v}"
23+
echo "Setting version to ${version}"
24+
# Update the version in pyproject.toml (assumes a `version = "..."` line)
25+
sed -i -E "s/^version = \"[^\"]+\"/version = \"${version}\"/" pyproject.toml
26+
1927
- name: Set up Python
2028
uses: actions/setup-python@v4
2129
with:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "volvocarsapi"
7-
version = "0.0.1"
7+
version = "0.0.0"
88
authors = [
99
{ name="thomasddn" },
1010
]

0 commit comments

Comments
 (0)