-
Notifications
You must be signed in to change notification settings - Fork 446
43 lines (39 loc) · 1.44 KB
/
publish-pypi.yml
File metadata and controls
43 lines (39 loc) · 1.44 KB
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
name: Publish to PyPi
# This will build a package with a version set by versioneer from the most recent tag matching v____
# It will publish to TestPyPi, and to real Pypi *if* run on master where head has a release tag
# For a live run, this should only need to be triggered by a newly published repo release.
# This can also be run manually for testing
on:
release:
types: [published]
workflow_dispatch:
push:
tags:
- 'v*.*.*'
jobs:
build-n-publish:
name: Build dist files for PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Build dist files
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test] build
python -m build
git describe --tag --dirty --always
- name: Publish distribution 📦 to Test PyPI # always run
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2
with:
password: ${{ secrets.PYPI_API_TOKEN }}