Skip to content

Commit 75b770a

Browse files
authored
Merge pull request #113 from livechat/separate-pypi-and-testpypi-publish-workflows
Separate PyPI and TestPyPI publish workflows
2 parents ee96b8c + 4649b47 commit 75b770a

File tree

2 files changed

+59
-30
lines changed

2 files changed

+59
-30
lines changed

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

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Publish Python distribution
1+
name: Publish Python distribution to PyPI
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
release:
5+
types: [published]
76

87
jobs:
98
build:
@@ -32,7 +31,6 @@ jobs:
3231

3332
publish-to-pypi:
3433
name: Publish to PyPI
35-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3634
needs:
3735
- build
3836
runs-on: ubuntu-latest
@@ -50,28 +48,3 @@ jobs:
5048
path: dist/
5149
- name: Publish to PyPI
5250
uses: pypa/gh-action-pypi-publish@release/v1
53-
54-
publish-to-testpypi:
55-
name: Publish to TestPyPI
56-
needs:
57-
- build
58-
runs-on: ubuntu-latest
59-
60-
environment:
61-
name: testpypi
62-
url: https://test.pypi.org/p/lc-sdk-python
63-
64-
permissions:
65-
id-token: write # IMPORTANT: mandatory for trusted publishing
66-
67-
steps:
68-
- name: Download all the dists
69-
uses: actions/download-artifact@v3
70-
with:
71-
name: python-package-distributions
72-
path: dist/
73-
- name: Publish to TestPyPI
74-
uses: pypa/gh-action-pypi-publish@release/v1
75-
with:
76-
skip-existing: true
77-
repository-url: https://test.pypi.org/legacy/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Python distribution to TestPyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.8"
19+
- name: Install pypa/build
20+
run: >-
21+
python3 -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: python3 -m build
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-testpypi:
34+
name: Publish to TestPyPI
35+
needs:
36+
- build
37+
runs-on: ubuntu-latest
38+
39+
environment:
40+
name: testpypi
41+
url: https://test.pypi.org/p/lc-sdk-python
42+
43+
permissions:
44+
id-token: write # IMPORTANT: mandatory for trusted publishing
45+
46+
steps:
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish to TestPyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
skip-existing: true
56+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)