Skip to content

Commit 6a673c8

Browse files
committed
Fix job conditions and artifact handling in pypi_release workflow for workflow_dispatch
1 parent 94f60c3 commit 6a673c8

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/pypi_release.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
publish:
3434
description: 'Set to true to publish to PyPI.'
3535
required: false
36-
default: 'false'
36+
default: false
3737
type: boolean
3838

3939
permissions:
@@ -83,7 +83,8 @@ jobs:
8383
needs: handle_result
8484
if: |
8585
always() &&
86-
(needs.handle_result.result == 'success' || needs.handle_result.result == 'skipped')
86+
(needs.handle_result.result == 'success' || needs.handle_result.result == 'skipped') &&
87+
(github.event_name == 'repository_dispatch' || inputs.publish)
8788
# "release" environment is configured in MaxText repository settings.
8889
# This environment requires manual approval before proceeding to the next job.
8990
environment: release
@@ -93,7 +94,9 @@ jobs:
9394

9495
build_maxtext_package:
9596
needs: release_approval
96-
if: needs.release_approval.result == 'success'
97+
if: |
98+
always() &&
99+
(needs.release_approval.result == 'success' || needs.release_approval.result == 'skipped')
97100
uses: ./.github/workflows/build_package.yml
98101
with:
99102
device_type: tpu
@@ -104,14 +107,15 @@ jobs:
104107

105108
publish_maxtext_to_pypi:
106109
name: Publish MaxText to PyPI
107-
needs: release_approval
110+
needs: [release_approval, build_maxtext_package]
108111
runs-on: ubuntu-latest
109112
environment: release
110-
if: github.event_name == 'repository_dispatch' || github.event.inputs.publish == 'true'
113+
if: needs.build_maxtext_package.result == 'success' && (github.event_name == 'repository_dispatch' || inputs.publish)
111114
steps:
112-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
115+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce
113116
with:
114117
name: maxtext-wheel
118+
path: dist/
115119
- name: Publish MaxText wheel to PyPI
116120
uses: pypa/gh-action-pypi-publish@release/v1
117121
with:
@@ -156,7 +160,7 @@ jobs:
156160
shell: bash
157161
run: |
158162
SOURCE_IMAGE="gcr.io/${{ vars.PROJECT_NAME }}/${{ matrix.image_name }}"
159-
GITHUB_RUN_ID="${{ github.event.client_payload.github_run_id }}"
163+
GITHUB_RUN_ID="${{ github.event_name == 'workflow_dispatch' && inputs.run_id || github.event.client_payload.github_run_id }}"
160164
gcloud container images add-tag \
161165
"${SOURCE_IMAGE}:${GITHUB_RUN_ID}" \
162166
"${SOURCE_IMAGE}:${{ needs.get_latest_maxtext_pypi_version.outputs.latest_pypi_version }}" \

0 commit comments

Comments
 (0)