make docker img #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
workflow_dispatch: | ||
jobs: | ||
code-quality: | ||
uses: ./.github/workflows/code-quality.yaml | ||
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: Define Docker tags | ||
id: define-tags | ||
run: | | ||
# Replace / with _ in github.ref_name | ||
BRANCH_NAME="${{ github.ref_name }}" | ||
TAG_NAME=$(echo "${BRANCH_NAME}" | sed 's/\//_/g') | ||
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | ||
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 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: release.Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.AWS_DOCKER_TAG }} | ||
${{ env.AWS_LATEST_TAG }} | ||
build-args: | | ||
BASE_IMAGE=mosaicml/pytorch:2.4.0_cu124-python3.11-ubuntu20.04-aws | ||
BRANCH_NAME=${{ env.BRANCH_NAME }} | ||
TE_COMMIT=901e5d2 | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: release.Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.DOCKER_TAG }} | ||
${{ env.LATEST_TAG }} | ||
build-args: | | ||
BASE_IMAGE=mosaicml/pytorch:2.4.0_cu124-python3.11-ubuntu20.04 | ||
BRANCH_NAME=${{ env.BRANCH_NAME }} | ||
TE_COMMIT=901e5d2 |