-
Notifications
You must be signed in to change notification settings - Fork 52
47 lines (38 loc) · 1.16 KB
/
publish.yml
File metadata and controls
47 lines (38 loc) · 1.16 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
44
45
46
47
name: Publish
permissions:
contents: write
attestations: write
pull-requests: write
on:
release:
types:
- published
jobs:
upload_release:
name: Upload release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.11"
cache: "pip"
- name: Releasing tag ${{ github.event.release.tag_name }}
run: |
# Get tag name from event
tag_name="${{ github.event.release.tag_name }}"
if [[ ! "$tag_name" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
cd $(echo $tag_name | rev | cut -d'/' -f2- | rev)
fi
# Install pypa/build
python -m pip install build --user
# Build a binary wheel and a source tarball
python -m build --sdist --wheel --outdir dist/ .
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}