-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (30 loc) · 1.11 KB
/
publish_package.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
name: Publish Package
on:
release:
types:
- published
workflow_dispatch: # enables manual triggering
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install toml requests packaging
- name: Validate Version
run: |
latest_version=$(curl -s https://pypi.org/pypi/views-stepshifter/json | jq -r .info.version)
new_version=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
python -c "from packaging.version import parse; assert parse('$new_version') > parse('$latest_version'), 'Version must be higher than $latest_version'"
- name: Publish to PyPI
run: poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}