Merge pull request #17 from yuchen0cc/main #5
Workflow file for this run
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: Build Wheel | |
on: | |
push: | |
tags: | |
- "osstorchconnector/v*" | |
- "ossmodelconnector/v*" | |
jobs: | |
build: | |
name: "Build Release" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login ghcr.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup buildx instance | |
uses: docker/setup-buildx-action@v2 | |
with: | |
use: true | |
- name: Build | |
shell: bash | |
run: | | |
REFS=${{ github.ref }} | |
REFS=${REFS#refs/tags/} | |
PACKAGE_NAME=${REFS%%/*} | |
echo "PACKAGE_NAME=${PACKAGE_NAME}" | |
RELEASE_VERSION="${REFS#*/v}" | |
echo "RELEASE_VERSION=${RELEASE_VERSION}" | |
PYTHON_VERSION=${{ matrix.python }} | |
PYTHON_VERSION=${PYTHON_VERSION//./} | |
echo "PYTHON_VERSION=${PYTHON_VERSION}" | |
BUILD_IMAGE="quay.io/pypa/manylinux2014_x86_64:2024-03-10-4935fcc" | |
echo "BUILD_IMAGE=${BUILD_IMAGE}" | |
RELEASE_IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}/connector_builder:${PACKAGE_NAME}-${RELEASE_VERSION}" | |
echo "RELEASE_IMAGE=${RELEASE_IMAGE}" | |
if [[ "${PACKAGE_NAME}" == "osstorchconnector" ]]; then | |
PACKAGE_DIR="oss-torch-connector" | |
elif [[ "${PACKAGE_NAME}" == "ossmodelconnector" ]]; then | |
PACKAGE_DIR="oss-model-connector" | |
fi | |
sed -i -e "s/version.*/version = \"${RELEASE_VERSION}\"/g" ${PACKAGE_DIR}/pyproject.toml | |
docker buildx build --build-arg BUILD_IMAGE=${BUILD_IMAGE} --build-arg RELEASE_IMAGE=${RELEASE_IMAGE} --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg PACKAGE_DIR=${PACKAGE_DIR} -f .github/workflows/build_wheel/Dockerfile -o dist/ . | |
ls -l dist/ | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ strategy.job-index }} | |
path: dist/oss*.whl | |
release: | |
name: "Tagged Release" | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Download builds and release notes | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
merge-multiple: true | |
path: dist | |
- name: Display downloaded files | |
shell: bash | |
run: | | |
ls -l dist | |
REFS=${{ github.ref }} | |
REFS=${REFS#refs/tags/} | |
echo "RELEASE_TAG=${REFS}" >> $GITHUB_ENV | |
- name: Create Release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.RELEASE_TAG }}" | |
prerelease: false | |
files: dist/osstorchconnector* |