forked from cytomining/pycytominer
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 1.56 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
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
release:
# only publish to pypi when gh release is published
types: [published]
env:
LANG: "en_US.utf-8"
LC_ALL: "en_US.utf-8"
PYTHONIOENCODING: "UTF-8"
TARGET_PYTHON_VERSION: "3.10"
jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
# We do not need to fetch all the history of the repository
# as commit being released is guaranteed to have a tag.
# poetry-dynamic-versioning will use that tag use to set the
# build version of the package.
fetch-depth: 1
- name: Setup base environment
uses: ./.github/actions/setup-env
with:
python-version: ${{ env.TARGET_PYTHON_VERSION }}
cache-pre-commit: false
cache-venv: false
setup-poetry: true
install-deps: false
- name: Build 📦 distributions
run: |
poetry build
- name: Publish any distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Publish tagged distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}