1919 type : string
2020 push :
2121 tags :
22- - " v*"
22+ - " v*" # core package tags
23+ - " *@v*" # package-scoped tags like package@v1.2.3
2324
2425jobs :
2526 build-n-publish :
2829 runs-on : ubuntu-latest
2930 permissions :
3031 contents : write
32+ strategy :
33+ fail-fast : false
34+ matrix :
35+ package : [llama-index-workflows, llama-index-utils-workflow]
36+ include :
37+ - package : llama-index-workflows
38+ is_core : true
39+ - package : llama-index-utils-workflow
40+ is_core : false
3141
3242 steps :
3343 - uses : actions/checkout@v4
@@ -37,42 +47,76 @@ jobs:
3747 - name : Install uv
3848 uses : astral-sh/setup-uv@v6
3949
40- - name : Validate version
41- if : startsWith(github.ref, 'refs/tags/')
50+ - name : Parse tag
51+ id : tag
52+ run : |
53+ REF_NAME="${GITHUB_REF_NAME}"
54+ if [[ "${REF_NAME}" == v* ]]; then
55+ PKG="llama-index-workflows"
56+ VERSION="${REF_NAME#v}"
57+ else
58+ # strip optional leading '@'
59+ REF_TRIMMED="${REF_NAME#@}"
60+ PKG_PART="${REF_TRIMMED%@v*}"
61+ PKG="${PKG_PART}"
62+ VERSION_PART="${REF_TRIMMED#*@v}"
63+ VERSION="${VERSION_PART}"
64+ fi
65+ echo "package=${PKG}" >> $GITHUB_OUTPUT
66+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
67+
68+ - name : Compute directory flag
69+ id : dir
70+ run : |
71+ if [ "${{ matrix.is_core }}" = "true" ]; then
72+ echo "dir_flag=" >> $GITHUB_OUTPUT
73+ else
74+ echo "dir_flag=--directory packages/${{ matrix.package }}" >> $GITHUB_OUTPUT
75+ fi
76+
77+ - name : Guard non-target matrix entry
78+ if : steps.tag.outputs.package != matrix.package
79+ run : echo "Skipping matrix package ${{ matrix.package }} for tag ${{ steps.tag.outputs.package }}" && exit 0
80+
81+ - name : Validate version (core only)
82+ if : startsWith(github.ref, 'refs/tags/') && matrix.is_core == true
4283 run : uv run python scripts/validate_version.py
4384
4485 - name : Set version output
4586 id : version
4687 run : |
47- VERSION=$(uv run python -c "from importlib.metadata import version; print(version('llama-index-workflows '))")
88+ VERSION=$(uv run ${{ steps.dir.outputs.dir_flag }} python -c "from importlib.metadata import version; print(version('${{ matrix.package }} '))")
4889 echo "Version: $VERSION"
4990 echo "version=$VERSION" >> $GITHUB_OUTPUT
5091
5192 - name : Build and publish
5293 env :
5394 UV_PUBLISH_TOKEN : ${{ secrets.PYPI_TOKEN }}
5495 run : |
55- uv build
56- uv publish
96+ uv build ${{ steps.dir.outputs.dir_flag }}
97+ uv publish ${{ steps.dir.outputs.dir_flag }}
5798
58- - name : Generate OpenAPI spec
99+ - name : Generate OpenAPI spec (core only)
100+ if : matrix.is_core == true
59101 run : |
60102 uv sync --all-extras
61103 uv run hatch run server:openapi
62104
63- - name : Create GitHub Release
105+ - name : Create GitHub Release (core only)
106+ if : matrix.is_core == true
64107 uses : ncipollo/release-action@v1
65108 with :
66109 artifacts : " dist/*,openapi.json"
67110 generateReleaseNotes : true
68111
69- - name : Detect change type for tags
112+ - name : Detect change type for tags (core only)
70113 id : detect_change
71- if : startsWith(github.ref, 'refs/tags/')
114+ if : startsWith(github.ref, 'refs/tags/') && matrix.is_core == true
72115 run : uv run python scripts/detect_change_type.py
73116
74117 - name : Set SDK trigger parameters
75118 id : sdk_params
119+ if : matrix.is_core == true
76120 run : |
77121 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
78122 echo "change_type=${{ github.event.inputs.server_change_type }}" >> $GITHUB_OUTPUT
@@ -84,14 +128,15 @@ jobs:
84128
85129 - name : Generate GitHub App Token
86130 id : app-token
131+ if : matrix.is_core == true
87132 uses : actions/create-github-app-token@v1
88133 with :
89134 app-id : ${{ secrets.CI_BOT_APP_ID }}
90135 private-key : ${{ secrets.CI_BOT_PRIVATE_KEY }}
91136 owner : run-llama
92137
93138 - name : Trigger SDK Update
94- if : steps.sdk_params.outputs.change_type != 'none' && steps.sdk_params.outputs.change_type != ''
139+ if : matrix.is_core == true && steps.sdk_params.outputs.change_type != 'none' && steps.sdk_params.outputs.change_type != ''
95140 uses : peter-evans/repository-dispatch@v3
96141 with :
97142 token : ${{ steps.app-token.outputs.token }}
0 commit comments