-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (70 loc) · 2.1 KB
/
manual-pypi-publish.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
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Manual Build and Publish PyPi Package
on:
workflow_dispatch:
inputs:
branch:
default: 'v1.1'
description: 'Branch to build the binary'
required: true
type: string
repo_list:
default: 'GenAIEval,GenAIComps'
description: 'List of repos to build the binary'
required: true
type: string
publish:
default: 'false'
description: 'Publish the binary to PyPi'
required: false
type: boolean
jobs:
get-test-matrix:
runs-on: ubuntu-latest
outputs:
repos: ${{ steps.get-matrix.outputs.repos }}
steps:
- name: Create Matrix
id: get-matrix
run: |
repos=($(echo ${{ inputs.repo_list }} | tr ',' ' '))
repos_json=$(printf '%s\n' "${repos[@]}" | sort -u | jq -R '.' | jq -sc '.')
echo "repos=$repos_json" >> $GITHUB_OUTPUT
run:
needs: get-test-matrix
strategy:
matrix:
repo: ${{ fromJson(needs.get-test-matrix.outputs.repos) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout out Repo
uses: actions/checkout@v4
with:
repository: opea-project/${{ matrix.repo }}
ref: ${{ inputs.branch }}
path: ${{ matrix.repo }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Build the binary
working-directory: ./${{ matrix.repo }}
run: |
pip list
python setup.py sdist bdist_wheel
- name: Publish the binary
if: ${{ inputs.publish == 'true' }}
env:
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade twine
python -m twine upload dist/*
- uses: actions/[email protected]
with:
name: ${{ matrix.repo }}-dist
path: ${{ matrix.repo }}/dist