|
| 1 | +# Copyright 2025 Google LLC |
| 2 | + |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | + |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# This workflow will build, test and automatically release MaxText package to PyPI using Trusted Publishing (OIDC). |
| 16 | + |
| 17 | +name: Publish MaxText to PyPI |
| 18 | + |
| 19 | +# Triggers when a new "release" is published in the GitHub UI |
| 20 | +on: |
| 21 | + release: |
| 22 | + types: [published] |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + issues: write |
| 27 | + id-token: write |
| 28 | + |
| 29 | +jobs: |
| 30 | + release_approval: |
| 31 | + name: Approve Release |
| 32 | + runs-on: ubuntu-latest |
| 33 | + # "release" environment is configured in MaxText repository settings. |
| 34 | + # This environment requires manual approval before proceeding to the next job. |
| 35 | + environment: release |
| 36 | + steps: |
| 37 | + - name: Acknowledge Approval |
| 38 | + run: echo "Release approved, proceeding to build, test and publish MaxText package." |
| 39 | + |
| 40 | + build_and_test_maxtext_package: |
| 41 | + name: Build and Test MaxText Package |
| 42 | + needs: [release_approval] |
| 43 | + uses: ./.github/workflows/build_and_test_maxtext.yml |
| 44 | + |
| 45 | + publish_maxtext_package_to_pypi: |
| 46 | + name: Publish MaxText package to PyPI |
| 47 | + needs: [build_and_test_maxtext_package] |
| 48 | + runs-on: ubuntu-latest |
| 49 | + environment: release |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 52 | + - name: Download MaxText wheel |
| 53 | + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 |
| 54 | + with: |
| 55 | + name: maxtext-wheel |
| 56 | + path: dist/ |
| 57 | + - name: Publish MaxText wheel to PyPI |
| 58 | + # Official action for PyPI Trusted Publishing |
| 59 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 60 | + with: |
| 61 | + packages-dir: dist/ |
0 commit comments