File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -48,18 +48,27 @@ jobs:
48
48
with open(os.environ['GITHUB_OUTPUT'], 'a') as out :
49
49
out.write(f'tags={tags_csv}\n')
50
50
out.write(f'push={push}\n')
51
+ - name : Set version
52
+ run : |
53
+ if [ '${{ github.ref_type }}' = 'tag' ]; then
54
+ rye version '${{ github.ref_name }}'
55
+ else
56
+ commit='${{ github.sha }}'
57
+ rye version "0.0.0-commit.${commit:0:7}"
58
+ fi
59
+ rye version > src/chrisomatic/version.txt
51
60
- name : Build Python wheel
52
61
run : rye build --wheel --clean
53
62
- uses : docker/setup-buildx-action@v3
54
63
- name : Login to DockerHub
55
- if : github.event_name == 'push' || github.event_name == 'release'
64
+ if : github.event_name == 'push'
56
65
id : dockerhub_login
57
66
uses : docker/login-action@v3
58
67
with :
59
68
username : ${{ secrets.DOCKERHUB_USERNAME }}
60
69
password : ${{ secrets.DOCKERHUB_PASSWORD }}
61
70
- name : Login to GitHub Container Registry
62
- if : github.event_name == 'push' || github.event_name == 'release'
71
+ if : github.event_name == 'push'
63
72
uses : docker/login-action@v3
64
73
with :
65
74
registry : ghcr.io
Original file line number Diff line number Diff line change 1
1
[project ]
2
2
name = " chrisomatic"
3
- version = " 0.9 .0"
3
+ version = " 0.0 .0" # version is set by `rye version` in .github/workflows/build.yml
4
4
description = " ChRIS backend provisioner"
5
5
authors = [
6
6
{
name =
" Jennings Zhang" ,
email =
" [email protected] " }
Original file line number Diff line number Diff line change 1
- from importlib .metadata import Distribution , PackageNotFoundError
2
-
3
-
4
- try :
5
- _pkg = Distribution .from_name (__package__ )
6
- __version__ = _pkg .version
7
- except PackageNotFoundError :
8
- __version__ = "unknown"
1
+ from __version__ import __version__
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ __file = Path (__file__ ).parent / "version.txt"
4
+ __version__ = __file .read_text () if __file .exists () else "0.0.0-unknown"
You can’t perform that action at this time.
0 commit comments