-
Notifications
You must be signed in to change notification settings - Fork 3
36 lines (35 loc) · 1.06 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
# Build the package and publish it to PyPI after tests pass.
# From https://discourse.jupyter.org/t/use-github-workflows-to-automatically-publish-to-pypi-when-new-tags-are-created/14941
# fetch-depth: 0 is needed to make `git describe` work.
name: Publish to PyPI
on:
push:
tags:
- "*"
jobs:
publish:
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Stamp Git tag and version
run: |
V=$(git describe --tags | tr -d 'v' | tr '-' '.' | cut -d'.' -f 1-4)
sed -i "s/0.0+unreleased.local/$V/" pyproject.toml
cat pyproject.toml
- name: Build package
run: |
python -m pip install -U pip build
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}