7
7
name : Build packages
8
8
9
9
on :
10
+ workflow_call :
11
+ inputs :
12
+ build_type :
13
+ description : The type of build version to produce ("stable", "rc", or "dev")
14
+ type : string
15
+ default : " rc"
10
16
workflow_dispatch :
17
+ inputs :
18
+ build_type :
19
+ description : The type of build version to produce ("stable", "rc", or "dev")
20
+ type : string
21
+ default : " rc"
11
22
schedule :
12
23
# Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8)
13
24
- cron : ' 0 11 * * *'
@@ -16,9 +27,7 @@ permissions:
16
27
contents : read
17
28
18
29
jobs :
19
- # Note: metadata generation could happen in a separate trigger/schedule
20
- # workflow. For cross platform builds, it's useful to just generate the
21
- # metadata on Linux and pass that to later jobs using artifacts.
30
+ # Generate metadata on Linux and pass to later jobs.
22
31
setup_metadata :
23
32
if : ${{ github.repository_owner == 'nod-ai' || github.event_name != 'schedule' }}
24
33
runs-on : ubuntu-24.04
@@ -34,18 +43,35 @@ jobs:
34
43
- name : Install Python packages
35
44
run : pip install packaging
36
45
46
+ # Compute version suffix based on inputs (default to 'rc')
47
+ - name : Compute stable version suffix
48
+ if : ${{ github.event.inputs.build_type == 'stable' }}
49
+ run :
50
+ version_suffix=""
51
+ echo "version_suffix=${version_suffix}" >> $GITHUB_ENV
52
+ - name : Compute rc version suffix
53
+ if : ${{ github.event.inputs.build_type == 'rc' || github.event.inputs.build_type == '' }}
54
+ run :
55
+ version_suffix="$(printf 'rc%(%Y%m%d)T')"
56
+ echo "version_suffix=${version_suffix}" >> $GITHUB_ENV
57
+ - name : Compute dev version suffix
58
+ if : ${{ github.event.inputs.build_type == 'dev' }}
59
+ run :
60
+ version_suffix=".dev0+${{ github.sha }}"
61
+ echo "version_suffix=${version_suffix}" >> $GITHUB_ENV
62
+
37
63
- name : Generate release candidate versions
38
64
id : version_rc
39
65
run : |
40
- version_suffix="$(printf 'rc%(%Y%m%d)T')"
41
66
echo "version_suffix=${version_suffix}" >> $GITHUB_OUTPUT
42
67
python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} sharktank
43
68
python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} shortfin
44
69
python3 build_tools/python_deploy/compute_common_version.py -rc --version-suffix=${version_suffix} --write-json
45
- - name : Upload version_local.json
70
+
71
+ - name : Upload version_local.json files
46
72
uses : actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
47
73
with :
48
- name : version_local
74
+ name : version_local_files
49
75
path : |
50
76
sharktank/version_local.json
51
77
shortfin/version_local.json
@@ -101,10 +127,10 @@ jobs:
101
127
path : " c" # Windows can hit path length limits, so use a short path.
102
128
submodules : false
103
129
104
- - name : Download version_local.json
130
+ - name : Download version_local.json files
105
131
uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
106
132
with :
107
- name : version_local
133
+ name : version_local_files
108
134
path : ./c/
109
135
merge-multiple : true
110
136
@@ -142,6 +168,7 @@ jobs:
142
168
path : bindist
143
169
144
170
- name : Release python wheels
171
+ if : ${{ github.event_name != 'workflow_call' }}
145
172
uses : ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
146
173
with :
147
174
artifacts : bindist/*.whl
0 commit comments