-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.22 KB
/
publish.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
name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- '*'
jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
# retrieve your distributions here
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}
- name: Update version in setup.py
run: |
VERSION=${{ steps.tag.outputs.TAG_NAME }}
VERSION=${VERSION#v}
sed -i "s/{{VERSION_PLACEHOLDER}}/$VERSION/g" setup.py
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1