-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (81 loc) · 2.75 KB
/
build_wheel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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/oss*.whl