-
Notifications
You must be signed in to change notification settings - Fork 226
67 lines (55 loc) · 1.79 KB
/
publish-to-pypi.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
name: Publish to PyPI
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set working directory
run: cd ${{ github.workspace }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Check for agenta version changes
id: version_check
run: |
# # Check if there are any tags in the repository
# if [ -z "$(git tag -l)" ]; then
# echo "No tags found. Skipping version check."
# exit 78
# fi
# Navigate to the cli directory
cd ${{ github.workspace }}/agenta-cli
# Verify that the pyproject.toml file exists
if [ ! -f pyproject.toml ]; then
echo "pyproject.toml file not found. Exiting..."
exit 1
fi
previous_version=$(git describe --abbrev=0 --tags)
current_version=$(poetry version --no-interaction | awk '{print $2}')
if [ "$previous_version" == "$current_version" ]; then
echo "No version change detected. Skipping package publication."
exit 78
fi
echo "::set-output name=version_bumped::true"
continue-on-error: true
- name: Build and publish agenta to PyPI
if: steps.version_check.outputs.version_bumped == 'true'
run: |
# Navigate to the cli directory
cd ${{ github.workspace }}
# Build and publish agenta-cli
cd agenta-cli
poetry build
poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
continue-on-error: true