-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.43 KB
/
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
name: Publish Python Package
on:
push:
branches:
- main
jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Get current version
id: get_version
run: |
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Check if version is pre-release
id: check_prerelease
run: |
if [[ "${{ env.VERSION }}" == *"alpha"* || "${{ env.VERSION }}" == *"beta"* ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
fi
- name: Check if version exists on PyPI
id: check_version
run: |
if curl -s https://pypi.org/pypi/manimextra/json | jq -e ".releases | has(\"${{ env.VERSION }}\")"; then
echo "VERSION_EXISTS=true" >> $GITHUB_ENV
else
echo "VERSION_EXISTS=false" >> $GITHUB_ENV
fi
- name: Publish to PyPI
if: env.IS_PRERELEASE == 'false' && env.VERSION_EXISTS == 'false'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI
poetry build
poetry publish