From 970f9939a05d426786972e78a45f806b627f3b0c Mon Sep 17 00:00:00 2001 From: v-chen_data Date: Tue, 24 Sep 2024 17:57:01 -0700 Subject: [PATCH] comment back in --- .github/workflows/release.yaml | 96 ++++++++++++++++------------------ 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 98b7ff3784..ec2f87d07f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,47 +10,46 @@ jobs: code-quality: uses: ./.github/workflows/code-quality.yaml - # rm for testing - # pypi-packaging: - # name: Build and Publish llm-foundry PyPI Package - # needs: - # - code-quality - # runs-on: linux-ubuntu-latest - # steps: - # - name: Checkout source - # uses: actions/checkout@v3 - - # - name: Set up Python - # uses: actions/setup-python@v3 - # with: - # python-version: "3.9" - - # - name: Build source and wheel distributions - # run: | - # if [[ "${{ github.ref }}" =~ refs\/tags\/v ]]; then - # PYPI_PACKAGE_NAME="llm-foundry" - # else - # PYPI_PACKAGE_NAME="llm-foundry-test-$(date +%Y%m%d%H%M%S)" - # fi - - # python -m pip install --upgrade build twine - # python -m build - # twine check --strict dist/* - - # - name: Publish 📦 to PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # if: contains(github.ref, 'refs/tags/v') - # with: - # user: __token__ - # password: ${{ secrets.PROD_PYPI_API_TOKEN }} - - # - name: Publish distribution 📦 to Test PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # if: contains(github.ref, 'refs/heads/') || contains(github.ref, 'refs/pull/') - # with: - # user: __token__ - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ + pypi-packaging: + name: Build and Publish llm-foundry PyPI Package + needs: + - code-quality + runs-on: linux-ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.9" + + - name: Build source and wheel distributions + run: | + if [[ "${{ github.ref }}" =~ refs\/tags\/v ]]; then + PYPI_PACKAGE_NAME="llm-foundry" + else + PYPI_PACKAGE_NAME="llm-foundry-test-$(date +%Y%m%d%H%M%S)" + fi + + python -m pip install --upgrade build twine + python -m build + twine check --strict dist/* + + - name: Publish 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: contains(github.ref, 'refs/tags/v') + with: + user: __token__ + password: ${{ secrets.PROD_PYPI_API_TOKEN }} + + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: contains(github.ref, 'refs/heads/') || contains(github.ref, 'refs/pull/') + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ build-docker: name: Build llm-foundry Release Docker Image @@ -78,17 +77,10 @@ jobs: TAG_NAME=$(echo "${BRANCH_NAME}" | sed 's/\//_/g') echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/v* ]]; then - # Official release (tag) - echo "DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}" >> $GITHUB_ENV - echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}_aws" >> $GITHUB_ENV - echo "LATEST_TAG=mosaicml/llm-foundry:release-latest" >> $GITHUB_ENV - echo "AWS_LATEST_TAG=mosaicml/llm-foundry:release_aws-latest" >> $GITHUB_ENV - else - # Testing release (manual) - echo "DOCKER_TAG=mosaicml/llm-foundry:test_release_${TAG_NAME}" >> $GITHUB_ENV - echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:test_release_${TAG_NAME}_aws" >> $GITHUB_ENV - fi + echo "DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}" >> $GITHUB_ENV + echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}_aws" >> $GITHUB_ENV + echo "LATEST_TAG=mosaicml/llm-foundry:release-latest" >> $GITHUB_ENV + echo "AWS_LATEST_TAG=mosaicml/llm-foundry:release_aws-latest" >> $GITHUB_ENV - name: Build and push AWS Docker image