-
Notifications
You must be signed in to change notification settings - Fork 69
49 lines (40 loc) · 1.17 KB
/
pypi-release.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
name: Release on PyPI
on:
release:
types: [released]
workflow_dispatch:
branches: [main]
inputs:
version:
description: 'Version'
required: true
jobs:
pypi_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
- name: Add Poetry to path
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install
sudo apt-get install progress
- name: Run tests
run: poetry run pytest
- name: Set version based on tag or input
run: |
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=${{ github.event.inputs.version }}
fi
poetry version $VERSION
- name: Configure Poetry
run: poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
- name: Publish package
run: poetry publish --build