-
Notifications
You must be signed in to change notification settings - Fork 1.4k
52 lines (45 loc) · 1.55 KB
/
cd.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
name: cd
on:
release:
types:
- published
permissions:
id-token: write
contents: read
jobs:
publish_to_pypi:
name: publish to pypi on new release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Poetry and dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
pip install requests
- name: Build and publish main package
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry build
VERSION=$(poetry version -s)
python -c "import requests; exit(0) if requests.get(f'https://pypi.org/pypi/pandasai/{VERSION}/json').status_code == 200 else exit(1)" || poetry publish
- name: Build and publish extensions
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
cd $GITHUB_WORKSPACE
find extensions -name pyproject.toml | while read -r project; do
dir=$(dirname "$project")
echo "Building and publishing $dir"
cd "$dir"
poetry build
PACKAGE_NAME=$(poetry version | cut -d' ' -f1)
VERSION=$(poetry version -s)
python -c "import requests; exit(0) if requests.get(f'https://pypi.org/pypi/{PACKAGE_NAME}/{VERSION}/json').status_code == 200 else exit(1)" || poetry publish
cd $GITHUB_WORKSPACE
done