Skip to content

Commit f0e06d2

Browse files
committed
Split PyPI and TestPyPI publishing workflows into separate files
1 parent 4b8173f commit f0e06d2

2 files changed

Lines changed: 41 additions & 7 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
jobs:
8+
build-n-publish:
9+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Get the version
14+
id: get_version
15+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
16+
- name: Replace version
17+
run: |
18+
echo Changing version in setup.py to ${{ steps.get_version.outputs.VERSION }}
19+
sed -i 's/VERSION = ".*"/VERSION = "${{ steps.get_version.outputs.VERSION }}"/g' setup.py
20+
- name: Set up Python 3.9
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: 3.9
24+
- name: Install pypa/build
25+
run: >-
26+
python -m
27+
pip install
28+
build
29+
--user
30+
- name: Build a binary wheel and a source tarball
31+
run: >-
32+
python -m
33+
build
34+
--sdist
35+
--wheel
36+
--outdir dist/
37+
- name: Publish distribution 📦 to PyPI
38+
if: startsWith(github.ref, 'refs/tags')
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/publish-to-test-pypi.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,3 @@ jobs:
3939
with:
4040
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
4141
repository-url: https://test.pypi.org/legacy/
42-
attestations: false
43-
- name: Publish distribution 📦 to PyPI
44-
if: startsWith(github.ref, 'refs/tags')
45-
uses: pypa/gh-action-pypi-publish@release/v1
46-
with:
47-
password: ${{ secrets.PYPI_API_TOKEN }}
48-
attestations: false

0 commit comments

Comments
 (0)