Repository navigation
40 lines (38 loc) · 1.54 KB
/
Copy pathrelease.yml
File metadata and controls
40 lines (38 loc) · 1.54 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
name: Publish to PyPI
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+.post[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
jobs:
build-and-publish:
name: publish to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python 3.12
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
# Keep in sync with --python-version in .github/build-requirements.txt
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --only-binary :all: --require-hashes -r .github/build-requirements.txt
- name: Build dists
# --no-isolation builds with the hash-locked setuptools and setuptools-scm installed
# above instead of resolving [build-system].requires from PyPI.
run: |
python -m build --no-isolation
- name: Publish distribution to Test Pypi
if: startsWith(github.ref, 'refs/tags') && contains(github.ref, '-rc')
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution to Pypi
if: startsWith(github.ref, 'refs/tags') && !contains(github.ref, '-rc')
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3