@@ -41,12 +41,11 @@ jobs:
4141 name : Build and Test MaxText Package
4242 needs : [release_approval]
4343 uses : ./.github/workflows/build_and_test_maxtext.yml
44+ secrets : inherit
4445
4546 publish_maxtext_package_to_pypi :
4647 name : Publish MaxText package to PyPI
47- # Temporarily only require release_approval for a one-time upload.
48- # Immediately revert this to `needs: [build_and_test_maxtext_package]`.
49- needs : [release_approval]
48+ needs : [build_and_test_maxtext_package]
5049 runs-on : ubuntu-latest
5150 environment : release
5251 steps :
6160 uses : pypa/gh-action-pypi-publish@release/v1
6261 with :
6362 packages-dir : dist/
63+
64+ get_latest_maxtext_pypi_version :
65+ name : Get latest MaxText PyPI version
66+ needs : [publish_maxtext_package_to_pypi]
67+ runs-on : ubuntu-latest
68+ outputs :
69+ latest_pypi_version : ${{ steps.get_version.outputs.version }}
70+ steps :
71+ - name : Install jq
72+ run : sudo apt-get update && sudo apt-get install -y jq
73+ - name : Fetch latest version of maxtext from PyPI
74+ id : get_version
75+ run : |
76+ # Fetch JSON from PyPI for 'maxtext'
77+ echo "Fetching latest version from https://pypi.org/pypi/maxtext/json"
78+ pypi_json=$(curl -s https://pypi.org/pypi/maxtext/json)
79+
80+ # Extract the version from the "info" section using jq
81+ latest_version=$(echo "$pypi_json" | jq -r ".info.version")
82+
83+ if [ -z "$latest_version" ] || [ "$latest_version" == "null" ]; then
84+ echo "Error: Could not parse latest version from PyPI JSON."
85+ exit 1
86+ fi
87+
88+ echo "Successfully fetched latest MaxText version on PyPI: $latest_version"
89+ # Set the output variable for other jobs to consume
90+ echo "version=$latest_version" >> "$GITHUB_OUTPUT"
91+
92+ # This job builds and pushes MaxText stable Docker images for both TPU and GPU devices.
93+ # It runs only after a new release is published to PyPI.
94+ # Creates docker image for MaxText commit corresponding to the release.
95+ upload_maxtext_docker_images :
96+ name : ${{ matrix.image_name }}
97+ needs : [get_latest_maxtext_pypi_version]
98+ strategy :
99+ fail-fast : false
100+ matrix :
101+ include :
102+ - device : tpu
103+ build_mode : stable
104+ image_name : maxtext_jax_stable
105+ workflow : pre-training
106+ dockerfile : ./src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
107+ - device : gpu
108+ build_mode : stable
109+ image_name : maxtext_gpu_jax_stable
110+ workflow : pre-training
111+ dockerfile : ./src/dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile
112+ - device : tpu
113+ build_mode : stable
114+ image_name : maxtext_post_training_stable
115+ workflow : post-training
116+ dockerfile : ./src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
117+ uses : ./.github/workflows/build_and_push_docker_image.yml
118+ with :
119+ image_name : ${{ matrix.image_name }}
120+ device : ${{ matrix.device }}
121+ build_mode : ${{ matrix.build_mode }}
122+ workflow : ${{ matrix.workflow }}
123+ dockerfile : ${{ matrix.dockerfile }}
124+ maxtext_sha : ${{ github.sha }}
125+ version_name : ${{ needs.get_latest_maxtext_pypi_version.outputs.latest_pypi_version }}
0 commit comments