-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (45 loc) · 1.62 KB
/
pypi-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
name: Packaging
on:
push:
pull_request:
release:
# "released" events are emitted either when directly be released or be edited from pre-released.
types: [prereleased, released]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up poetry
uses: abatilo/actions-poetry@v2
- name: Cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-build-${{ matrix.python }}-
${{ runner.os }}-
- run: poetry install
- name: Build
# I use poetry just as a package manager, so this is not `poetry build`
run: poetry run poe build
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.release.prerelease
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: github.event_name == 'release' && !github.event.release.prerelease
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}