Skip to content

Commit 5bf9de0

Browse files
committed
Update publish.yml
1 parent 777aff3 commit 5bf9de0

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,50 @@
1-
name: Publish Python Package
1+
# .github/workflows/publish.yml
2+
3+
name: Publish Package
24

35
on:
46
push:
57
branches:
6-
- master
8+
- main
79

810
jobs:
911
test:
1012
runs-on: ubuntu-latest
11-
1213
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v3
14+
- name: Check out code
15+
uses: actions/checkout@v2
1516

1617
- name: Set up Python
17-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v3
1819
with:
19-
python-version: '3.x'
20+
python-version: '3.11' # Set your Python version here
2021

2122
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements.txt
25-
pip install pytest
23+
run: pip install -r requirements.txt
2624

2725
- name: Run tests
2826
run: pytest tests/
2927

3028
publish:
3129
runs-on: ubuntu-latest
32-
needs: test # Run only if tests succeed
33-
30+
needs: test
3431
steps:
35-
- name: Checkout repository
36-
uses: actions/checkout@v3
32+
- name: Check out code
33+
uses: actions/checkout@v2
3734

3835
- name: Set up Python
39-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v3
4037
with:
41-
python-version: '3.x'
38+
python-version: '3.11'
4239

4340
- name: Install dependencies
44-
run: |
45-
python -m pip install --upgrade pip
46-
pip install setuptools wheel twine
41+
run: pip install -r requirements.txt
4742

4843
- name: Build package
4944
run: python setup.py sdist bdist_wheel
5045

51-
- name: Publish package to PyPI
52-
env:
53-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
54-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
55-
run: |
56-
twine upload dist/*
46+
- name: Publish to PyPI
47+
uses: pypa/gh-action-pypi-publish@v1.7.1
48+
with:
49+
password: ${{ secrets.PYPI_API_TOKEN }}
50+

0 commit comments

Comments
 (0)