Skip to content

Commit 20a7913

Browse files
committed
Add build_type input to build_packages.yml.
1 parent 0ae1e75 commit 20a7913

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

.github/workflows/build_packages.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77
name: Build packages
88

99
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"
1016
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"
1122
schedule:
1223
# Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8)
1324
- cron: '0 11 * * *'
@@ -16,9 +27,7 @@ permissions:
1627
contents: read
1728

1829
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.
2231
setup_metadata:
2332
if: ${{ github.repository_owner == 'nod-ai' || github.event_name != 'schedule' }}
2433
runs-on: ubuntu-24.04
@@ -34,18 +43,35 @@ jobs:
3443
- name: Install Python packages
3544
run: pip install packaging
3645

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+
3763
- name: Generate release candidate versions
3864
id: version_rc
3965
run: |
40-
version_suffix="$(printf 'rc%(%Y%m%d)T')"
4166
echo "version_suffix=${version_suffix}" >> $GITHUB_OUTPUT
4267
python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} sharktank
4368
python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} shortfin
4469
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
4672
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
4773
with:
48-
name: version_local
74+
name: version_local_files
4975
path: |
5076
sharktank/version_local.json
5177
shortfin/version_local.json
@@ -101,10 +127,10 @@ jobs:
101127
path: "c" # Windows can hit path length limits, so use a short path.
102128
submodules: false
103129

104-
- name: Download version_local.json
130+
- name: Download version_local.json files
105131
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
106132
with:
107-
name: version_local
133+
name: version_local_files
108134
path: ./c/
109135
merge-multiple: true
110136

@@ -142,6 +168,7 @@ jobs:
142168
path: bindist
143169

144170
- name: Release python wheels
171+
if: ${{ github.event_name != 'workflow_call' }}
145172
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
146173
with:
147174
artifacts: bindist/*.whl

0 commit comments

Comments
 (0)