Skip to content

Commit b792058

Browse files
Create publish.yml
1 parent 8e4e0e5 commit b792058

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
publish-to-test-pypi:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "3.x"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build
24+
- name: Build package
25+
run: python -m build
26+
- name: Publish package to test
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
with:
29+
repository-url: https://test.pypi.org/legacy/
30+
user: __token__
31+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
32+
33+
publish-to-prod-pypi:
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Set up Python
39+
uses: actions/setup-python@v3
40+
with:
41+
python-version: "3.x"
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install build
46+
- name: Build package
47+
run: python -m build
48+
- name: Publish package to prod
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)