|
1 |
| -name: Publish Python Package |
| 1 | +# .github/workflows/publish.yml |
| 2 | + |
| 3 | +name: Publish Package |
2 | 4 |
|
3 | 5 | on:
|
4 | 6 | push:
|
5 | 7 | branches:
|
6 |
| - - master |
| 8 | + - main |
7 | 9 |
|
8 | 10 | jobs:
|
9 | 11 | test:
|
10 | 12 | runs-on: ubuntu-latest
|
11 |
| - |
12 | 13 | steps:
|
13 |
| - - name: Checkout repository |
14 |
| - uses: actions/checkout@v3 |
| 14 | + - name: Check out code |
| 15 | + uses: actions/checkout@v2 |
15 | 16 |
|
16 | 17 | - name: Set up Python
|
17 |
| - uses: actions/setup-python@v4 |
| 18 | + uses: actions/setup-python@v3 |
18 | 19 | with:
|
19 |
| - python-version: '3.x' |
| 20 | + python-version: '3.11' # Set your Python version here |
20 | 21 |
|
21 | 22 | - 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 |
26 | 24 |
|
27 | 25 | - name: Run tests
|
28 | 26 | run: pytest tests/
|
29 | 27 |
|
30 | 28 | publish:
|
31 | 29 | runs-on: ubuntu-latest
|
32 |
| - needs: test # Run only if tests succeed |
33 |
| - |
| 30 | + needs: test |
34 | 31 | steps:
|
35 |
| - - name: Checkout repository |
36 |
| - uses: actions/checkout@v3 |
| 32 | + - name: Check out code |
| 33 | + uses: actions/checkout@v2 |
37 | 34 |
|
38 | 35 | - name: Set up Python
|
39 |
| - uses: actions/setup-python@v4 |
| 36 | + uses: actions/setup-python@v3 |
40 | 37 | with:
|
41 |
| - python-version: '3.x' |
| 38 | + python-version: '3.11' |
42 | 39 |
|
43 | 40 | - 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 |
47 | 42 |
|
48 | 43 | - name: Build package
|
49 | 44 | run: python setup.py sdist bdist_wheel
|
50 | 45 |
|
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