-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (41 loc) · 1.52 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
name: Publish to PyPI
on: push
jobs:
build-and-publish:
name: Build and publish to PyPI
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/[email protected]
with:
python-version: '3.9'
- name: Install build dependencies
run: |
pip install -U setuptools wheel build
# This allows every individual development version to be pushed to Test PyPI
# using the timestamp as part of the version number.
- name: Add timestamp for Test PyPI
if: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
run: |
sed -i "\$s/\$/'\-dev$(date +%s)'/" verto/__init__.py
- name: Build distribution files
run: |
python -m build .
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
# This secret needs to be added as both an Actions secret
# and a Dependabot secret so that this workflow works for
# user pushes and dependabot pushes
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}