44
55name : " CI: Release"
66
7- # Manually-triggered release workflow. Creates a release draft if one doesn't exist for the given tag, or uses existing draft.
7+ # Manually-triggered release workflow. Creates a release draft if one doesn't exist
8+ # for the given tag, or uses an existing draft, then publishes the selected wheels
9+ # to TestPyPI followed by PyPI.
810
911on :
1012 workflow_dispatch :
2830 required : false
2931 type : string
3032 default : " "
31- build-ctk-ver :
32- type : string
33- required : true
34- wheel-dst :
35- description : " Which wheel index to publish to?"
36- required : true
37- type : choice
38- options :
39- - testpypi
40- - pypi
4133
4234defaults :
4335 run :
@@ -60,15 +52,10 @@ jobs:
6052 env :
6153 GH_TOKEN : ${{ github.token }}
6254 run : |
63- if [[ -n "${{ inputs.run-id }}" ]]; then
64- echo "Using provided run ID: ${{ inputs.run-id }}"
65- echo "run-id=${{ inputs.run-id }}" >> $GITHUB_OUTPUT
66- else
67- echo "Auto-detecting successful tag-triggered run ID for tag: ${{ inputs.git-tag }}"
68- RUN_ID=$(./ci/tools/lookup-run-id "${{ inputs.git-tag }}" "${{ github.repository }}")
69- echo "Auto-detected run ID: $RUN_ID"
70- echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT
71- fi
55+ echo "Auto-detecting successful tag-triggered run ID for tag: ${{ inputs.git-tag }}"
56+ RUN_ID=$(./ci/tools/lookup-run-id "${{ inputs.git-tag }}" "${{ github.repository }}")
57+ echo "Auto-detected run ID: $RUN_ID"
58+ echo "run-id=$RUN_ID" >> "$GITHUB_OUTPUT"
7259
7360 check-tag :
7461 runs-on : ubuntu-latest
@@ -82,17 +69,11 @@ jobs:
8269 env :
8370 GH_TOKEN : ${{ github.token }}
8471 run : |
85- tags=
86- for i in $(gh release list -R ${{ github.repository }} --json tagName --jq '.[]| .tagName'); do
87- tags+=( $i )
88- done
89- is_draft=
90- for i in $(gh release list -R ${{ github.repository }} --json isDraft --jq '.[]| .isDraft'); do
91- is_draft+=( $i )
92- done
72+ mapfile -t tags < <(gh release list -R "${{ github.repository }}" --json tagName --jq '.[] | .tagName')
73+ mapfile -t is_draft < <(gh release list -R "${{ github.repository }}" --json isDraft --jq '.[] | .isDraft')
9374
9475 found=0
95- for idx in ${!tags[@]}; do
76+ for idx in " ${!tags[@]}" ; do
9677 if [[ "${tags[$idx]}" == "${{ inputs.git-tag }}" ]]; then
9778 echo "found existing release for ${{ inputs.git-tag }}"
9879 found=1
@@ -122,7 +103,6 @@ jobs:
122103 secrets : inherit
123104 uses : ./.github/workflows/build-docs.yml
124105 with :
125- build-ctk-ver : ${{ inputs.build-ctk-ver }}
126106 component : ${{ inputs.component }}
127107 git-tag : ${{ inputs.git-tag }}
128108 run-id : ${{ needs.determine-run-id.outputs.run-id }}
@@ -143,16 +123,16 @@ jobs:
143123 run-id : ${{ needs.determine-run-id.outputs.run-id }}
144124 component : ${{ inputs.component }}
145125
146- publish-wheels :
147- name : Publish wheels
126+ publish-testpypi :
127+ name : Publish wheels to TestPyPI
148128 runs-on : ubuntu-latest
149129 needs :
150130 - check-tag
151131 - determine-run-id
152132 - doc
153133 environment :
154- name : ${{ inputs.wheel-dst }}
155- url : https://${{ ( inputs.wheel-dst == 'testpypi ' && 'test.' ) || '' }}pypi.org/p/${{ inputs.component }}/
134+ name : testpypi
135+ url : https://test.pypi.org/ ${{ inputs.component != 'all ' && format('p/{0}/', inputs.component ) || '' }}
156136 permissions :
157137 id-token : write
158138 steps :
@@ -169,14 +149,37 @@ jobs:
169149 run : |
170150 ./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "dist"
171151
172- - name : Publish package distributions to PyPI
173- if : ${{ inputs.wheel-dst == 'pypi' }}
174- uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
175-
176152 - name : Publish package distributions to TestPyPI
177- if : ${{ inputs.wheel-dst == 'testpypi' }}
178153 uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
179154 with :
180155 repository-url : https://test.pypi.org/legacy/
181156
157+ publish-pypi :
158+ name : Publish wheels to PyPI
159+ runs-on : ubuntu-latest
160+ needs :
161+ - determine-run-id
162+ - publish-testpypi
163+ environment :
164+ name : pypi
165+ url : https://pypi.org/${{ inputs.component != 'all' && format('p/{0}/', inputs.component) || '' }}
166+ permissions :
167+ id-token : write
168+ steps :
169+ - name : Checkout Source
170+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
171+
172+ - name : Download component wheels
173+ env :
174+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
175+ run : |
176+ ./ci/tools/download-wheels "${{ needs.determine-run-id.outputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "dist"
177+
178+ - name : Validate wheel versions for release tag
179+ run : |
180+ ./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "dist"
181+
182+ - name : Publish package distributions to PyPI
183+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
184+
182185 # TODO: add another job to make the release leave the draft state?
0 commit comments