Skip to content

Commit c94d41f

Browse files
committed
Determine version dynamically
1 parent 8a52bb5 commit c94d41f

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Publish Release
22

33
on:
4-
workflow_dispatch:
4+
push:
5+
tags:
6+
- v*
57

68
jobs:
79
release:
@@ -23,4 +25,4 @@ jobs:
2325
- name: Create release & upload wheel
2426
run: |
2527
version=$(uv version --short)
26-
gh release create --generate-notes --latest -t "v${version}" "v${version}" dist/*.whl
28+
gh release create --generate-notes --latest -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" dist/*.whl

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ __pycache__
44

55
# build artifacts
66
dist/
7+
_version.py
78

89
# docs build artifacts
910
/docs/html/

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Highlights include:
3737

3838
## Releasing a new version
3939

40-
1. Bump version in `pyproject.toml` & commit it.
41-
3. Push to origin.
42-
4. On GitHub > Actions, run "release" action against `master`.
40+
1. Create a tag in the format `v<major>.<minor>.<patch>`
41+
2. Push the tag to origin.
42+
43+
A github action should be created that builds a WHEEL file,
44+
creates a release for this tag
45+
and attaches the WHEEL file as an artifact.

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sublime_lib"
3-
version = "1.6.0"
3+
dynamic = ["version"]
44
description = "Utility library for frequently used functionality in Sublime Text"
55
readme = "README.md"
66
license = {file = "LICENSE"}
@@ -33,6 +33,13 @@ exclude = [
3333
"*.lock",
3434
]
3535

36+
[tool.hatch.version]
37+
source = "vcs"
38+
39+
[tool.hatch.build.hooks.vcs]
40+
version-file = "src/sublime_lib/_version.py"
41+
tag-pattern = "v{version}"
42+
3643
[tool.coverage.run]
3744
omit = [
3845
"*/tests/*",

0 commit comments

Comments
 (0)